杀死进程命令

  1、查看进程列表

    tasklist

   

  2、杀死进程

    查看格式:taskkill /?

    

    

     杀死进程id为12664的进程:taskkill /pid 12664 /f

     

    Python代码:

    os.system('taskkill /pid 12664 /f')

    或者

    os.system('taskkill /f /im Microsoft.Photos.exe')

    注意,后者是按照exe名称杀进程的,会把同名的所有程序都杀死,如果你运行两个以上的python脚本,会把所有python脚本进程都杀死。前者是根据唯一的PID来杀的,准确安全

原文地址:https://www.cnblogs.com/shaosks/p/7767715.html