Dos命令之进程操作总结

查看端口和对应PID

 netstat -ano 

查看指定端口占用情况

netstat -ano|findstr 80 

查看PID对应的进程

tasklist|findstr "2155"  

查看某端口是否被占用(如果有显示则已被占用)

netstat –ano|findstr 3389

查看pid对应的服务

tasklist  

通过pid查看是哪个服务

tasklist|findstr 4828

通过pid终止程序

taskkill /pid 2233

通过进程名终止程序

taskkill /im TIM.exe –f –t
如果结束不掉进程,我们可以使用-F和-T来强制结束指定的进程和子进程。  

通过pid查看对应文件的位置

wmic process get name,executablepath,processid|findstr [pid]

查看所有运行中进程的命令行参数

wmic process get caption,commandline /value

模糊查找

wmic process where "Caption like 'WeChat%'" get caption,commandline /value

精确查找

wmic process where caption="firefox.exe" get caption,commandline /value

查看所有服务的路径,PID,状态等

wmic service get name,pathname,processid,startname,status,state /value

查看进程的名字PID启动路径等

wmic process get CreationDate,name,processid,commandline,ExecutablePath /value

通过pid或者服务名查看对应文件的位置

wmic process get name,processid,executablepath| findstr "7766"
wmic process get name,processid,executablepath| findstr “WeChat”

如有缺漏,请留言补充!

原文地址:https://www.cnblogs.com/maohai-kdg/p/13892152.html