当前位置:天才代写 > tutorial > Python教程 > Python 判断一个进程是否存在

Python 判断一个进程是否存在

2018-05-17 08:00 星期四 所属: Python教程 浏览:295

Pythonjiaocheng/20171102/376.html">python">#-*- coding:utf-8 -*-

import win32com.client

def check_exsit(process_name):
    WMI = win32com.client.GetObject('winmgmts:')
    processCodeCov = WMI.ExecQuery('select * from Win32_Process where Name="%s"' % process_name)
    if len(processCodeCov) > 0:
        print '%s is exists' % process_name
    else:
        print '%s is not exists' % process_name

if __name__ == '__main__':
    check_exsit('chrome.exe')

标签:Pythonjiaocheng/20171102/376.html”>python

 

    关键字:

天才代写-代写联系方式