I have one function in python which should start running when some process (eg. proc.exe) showed up in tasks manager.
How can I monitor processes running in tasks manager with python?
views:
863answers:
5
+6
A:
here is something, I've adapted from microsoft
import win32com.client strComputer = "." objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator") objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2") colItems = objSWbemServices.ExecQuery("Select * from Win32_Process") for objItem in colItems: print "Name: ", objItem.Name print "File location: ", objItem.ExecutablePath
There is here a lot of nice examples for python and windows
Update: objItem.ExecutablePath gives the file location of the exe
luc
2009-07-27 09:54:04
+1 as Nikki stated: 'great script' :-)
Blauohr
2009-07-27 10:54:31
A:
Your script is great, but I have another question. Is there a way to get file location of objItem?
See my update! Please use comments rather than adding another answer when you want some details for a specific answer
luc
2009-07-27 11:51:50