Hi,<br><br>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 parameters. <br><br>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.
<br><br>Then I found the WMI module on <a href="http://tgolden.sc.sabren.com/python/wmi_cookbook.html#running_processes">http://tgolden.sc.sabren.com/python/wmi_cookbook.html#running_processes</a> that seems to do the trick:
<br><pre class="code">import wmi<br>c = wmi.WMI ()<br>for process in c.Win32_Process ():<br> print process.CommandLine<br></pre>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.
<br><br>Thanks,<br>Patrick<br><br>