Search code examples
pythonpython-2.2

How to check if a process is running in windows using python 2.2?


I need to verify is a process is running in windows (all versions upper windows xp) using only python 2.2. Any idea?


Solution

  • solved:

    from win32com.client import GetObject
    WMI = GetObject('winmgmts:')
    
    if len(WMI.ExecQuery('select * from Win32_Process where Name like "%s%s"' % ("process_name",'%'))) > 0:
        pass