pip install pywin32
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('360se.exe')
本文介绍了一个使用Python和pywin32库检查特定进程是否存在的方法。通过win32com客户端获取Windows管理规范(WMI)对象,并执行查询来查找指定名称的进程。如果找到该进程,则输出存在提示;反之,则输出不存在提示。
4475

被折叠的 条评论
为什么被折叠?



