Doing a ps in windows.. (Is application XYZZY running?)

Wolfgang Strobl ws at mystrobl.de
Mon Mar 25 21:25:32 EST 2002


Mon, 25 Mar 2002 20:54:19 GMT, Andrew Markebo
<flognat at flognat.myip.org>:

>*blush* yeah I know.. not really.. here, only almost :-)
>
>I have the windows-compiled python 2.2, and I would like to see if
>Opera or Netscape is running on my computer (poor sod, running Win2k,
>XP or 98).. How do I do this, I suppose I could use something in the
>win32api, but what is something.. :-) ??
>
>On unix I do "ps -ef | grep netscape" ;-)

On Windows, I do 

>>> import win32pdh
>>> junk, instances = win32pdh.EnumObjectItems(None,None,"process",
...     win32pdh.PERF_DETAIL_WIZARD)
>>> "python" in instances
1
>>> "netscape" in instances
0
>>>

(straight from an example in the win32pdh documentation)

-- 
Wir danken für die Beachtung aller Sicherheitsbestimmungen



More information about the Python-list mailing list