[python-win32] How to get command line parameters of running processes via pywin32
patrick at gxlinc.com
Wed Dec 5 19:04:20 CET 2007
I am interested in scanning the user's process table periodically and
getting the list of running process names as well as their command line
For the process names, I am able to get the list of pids using
win32process.EnumProcesses and then use win32api.OpenProcess and
win32process.GetModuleFileNameEx to get the names. However, I couldn't find
anywhere in the doc that tells me how to get the command line parameters for
them as well.
Then I found the WMI module on
seems to do the trick:
c = wmi.WMI ()
for process in c.Win32_Process ():
Is that the most efficient way to get the command line parameters? My
program will need to scan the process table quite often, so I am trying to
make this operation as lightweight as noticeable.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the python-win32