Getting Process Name on Win32
stefan.rank at ofai.at
Wed Sep 6 13:13:26 CEST 2006
[BTW, there is a list/newsgroup specifically for pywin32]
on 06.09.2006 12:56 Rama said the following:
> I want to list the names of all the processes running on my
> machine. I am stuck at this point and do not know how to extract the
> name of a process.
> Using win32process.EnumProcesses, I am able to obtain the pids of
> all the processes and using win32api.OpenProcess() I have obtained a
> handle to the process. However, I could not find an appropriate method
> to provide me the name of the process. I went through the available
> documentation on the
> site - but could not find something to help me.
> Could some one please guide me on this?
This is not directly what you wanted, but it works for me::
In : import win32com.client
In : wmi = win32com.client.GetObject('winmgmts:')
In : procs = wmi.ExecQuery('Select * from win32_process')
In : for proc in procs:
...: print proc.Name
System Idle Process
There are also python-packages that encapsulate dealing with wmi.
More information about the Python-list