您好,欢迎来到花图问答。
搜索
您的当前位置:首页python如何判断一个进程是否存在

python如何判断一个进程是否存在

来源:花图问答

python如何判断一个进程是否存在?

python学习网,大量的免费,欢迎在线学习!

相关推荐:《》

源代码如下:

#-*- coding:utf-8 -*-
def check_exsit(process_name):
import win32com.client
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')

Copyright © 2019- huatuowenda.com 版权所有 湘ICP备2023022495号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务