wsh ProcessID

John Schmitt jschmitt at
Tue Aug 13 01:27:37 CEST 2002

Based on reading some MSDN docs,

I thought the program below would reveal the PID of Notepad.exe, the same
one that the Task Manager reveals.  Any clues on where to look next to get
the PID or how to access WSH Shell properties in general?

import win32com.client

shell = win32com.client.Dispatch("WScript.Shell")
shell.Run( r"C:\winnt\notepad.exe" )
print shell.ProcessID()

Traceback (most recent call last):
  File "D:\work\autodx\", line 5, in ?
    print shell.ProcessID()
  File "C:\Python22\lib\site-packages\win32com\client\", line 438,
in __getattr__
    raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: WScript.Shell.ProcessID


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list