Windows checks the python or bat script executing in the background

As we all know, in the Linux environment, you can directly ps -ef | grep 'shell script name' to view the shell being executed in the background. However, on Windows, you cannot use the tasklist command or task manager to find the background information through the script name (its background name is both It is cmd.exe and cannot identify which script is executed). At this time, you need to use the wmic tool to help find it.

example:

Execute a continuously running test.bat script.

Traditional method: tasklist | findstr test.bat cannot find process information.

Solution: wmic process get commandline,processid | findstr test.bat | findstr /v findstr

The full path of the command and the process number are output.

 

Note: The full name of wmic is Windows Management Instrumentation Command-line, which is translated as windows command line management tool. It is a much more powerful tool than cmd. The second column, process, represents process management, and the third column, get, represents obtaining attributes.

Guess you like

Origin blog.csdn.net/jiujiederoushan/article/details/127802148