windows上用netstat查看端口/进程占用

windows上用netstat命令查看某个端口是否占用,被哪个进程所占用

1.查看端口的占用情况,获取进程的PID

命令:

netstat -ano | findstr "<端口号>"

比如:查看6924端口号的占用情况

C:Windowsmy_server>netstat -ano | findstr "5924"
TCP 0.0.0.0:5924 0.0.0.0:0 LISTENING 1448

2.查找PID对应的进程

命令:

tasklist | findstr "<PID>"

比如:查找PID=1448对应的进程

C:Windowsvdi_server>tasklist |findstr "1448"
MyAgt.exe 1448 Services 0 32,296 K

参考资料:

http://ywsm.iteye.com/blog/510670

原文地址:https://www.cnblogs.com/bugchecker/p/get_port_info_using_netstat_command.html