Home > Backend Development > Python Tutorial > python 判断一个进程是否存在

python 判断一个进程是否存在

WBOY
Release: 2016-06-16 08:47:32
Original
2165 people have browsed it

源代码如下:

复制代码 代码如下:

#-*- 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')
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template