tags:

views:

57

answers:

1

as above, is there a way to find out what python scripts are running in windows?

+2  A: 

If you have PowerShell installed, you can get that information by using Windows Management Instrumentation (WMI) and some scripting...

Open the PowerShell and use these two lines, it should could you started:

> $pys = get-wmiobject Win32_process -filter "Name='python.exe'"
> $pys.CommandLine

This will show you the command line arguments used to start the python process, which should contain the name of the main script file ran by Python. For a test program I have, it displays the following:

"C:\Python27\python.exe" "D:\Projects\wait.py"

In case you have multiple scripts running, the var $pys will be an array, so to access it you'll have to access the individual elements like so:

> $pys[0].CommandLine

EDIT: Or you could do it all in one single line, again in PowerShell:

 > get-wmiobject Win32_process -filter "Name='python.exe'" | foreach -process {$_.CommandLine}

I hope you get the general idea.

ShaderOp
works , WMI is just what I need.
goh