Python3之查看windows下所有进程并杀死指定进程

import psutil
pids = psutil.pids()
    for pid in pids:
        p = psutil.Process(pid)
        # print('pid-%s,pname-%s' % (pid, p.name()))
        if p.name() == 'dllhost.exe':
            cmd = 'taskkill /F /IM dllhost.exe'
            os.system(cmd)

猜你喜欢

转载自blog.csdn.net/qq_33733970/article/details/80751957