python 显示当前系统中的所有进程并关闭指定进程python 显示当前系统中的所有进程并关闭指定进程python 显示当前系统中的所有进程并关闭指定进程python 显示当前系统中的所有进程并关闭指定进程
  • 首页
  • 博客
  • 书签
  • 文件
  • 分析
  • 登录

python 显示当前系统中的所有进程并关闭指定进程

发表 admin at 2022年3月19日
类别
  • Python
标签
环境:

Windows 10操作系统

python idle

原理:

调用windows系统自带的命令task,该命令使用方式:

第一步、调用cmd命令行,显示当前系统中所有进程;

    Win+R->cmd->(input)tasklist

第二步、调用taskkill命令,关闭指定的进程;

taskkill [/S system [/U username [/P [password]]]]

            {[/FI filter] [/PID processid] | /IM imagename} [/T] [/F]

进程终止过程示例:

##假定关闭进程SougouCloud.exe

一、window10 cmd命令行中

C:\User\username\ tasklist            ##显示的列表中查看是否找到SougouCloud.exe
C:\User\username\ taskkill /IM SougouCloud.exe /F

二、python idle中

>>>import os
>>>print(os.popen('tasklist'))
>>>os.system('taskkill /IM SougouCloud.exe /F')

发表回复 取消回复

要发表评论,您必须先登录。

类别

  • Cat
  • Python
  • Django
  • Database
  • Html/CSS
  • JavaScript
  • Vue
  • RegExp
  • Maths/AI
  • PHP/Wordpress
  • Practice
  • Linux
  • Windows
  • Android
  • NAS
  • Software
  • Hardware
  • Network
  • SEO
  • English
  • Games
  • Recipes
  • General
  • Memorandum
  • Essays
  • 未分类

归档

©2015-2023 艾丽卡 Blog support@alaica.com
      ajax-loader