Killing processes with PSUTIL

后端 未结 5 1468
陌清茗
陌清茗 2021-01-12 07:58

I\'m looking to write some code that will kill off a process based on it\'s name and who owns it. This works fine on Windows XP but when I come to run the same code on Windo

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-12 08:42

    In case psutil does not work, you can always try using taskkill through os.system (command prompt) Example to kill all excel instances:

    import os
    os.system("""taskkill /f /im excel.exe""")
    

提交回复
热议问题