tasklist
查看当前运行的进程
netstat
netstat -ano | findStr PID
查看某个进程占用了哪些端口
TCP 127.0.0.1:2436 127.0.0.1:9999 ESTABLISHED 22588
TCP 127.0.0.1:8080 0.0.0.0:0 LISTENING 22588
TCP 127.0.0.1:8080 127.0.0.1:2476 ESTABLISHED 22588
TCP 127.0.0.1:8080 127.0.0.1:2477 ESTABLISHED 22588
TCP 127.0.0.1:8080 127.0.0.1:2478 ESTABLISHED 22588
TCP 127.0.0.1:8080 127.0.0.1:2496 ESTABLISHED 22588
TCP 192.168.231.137:2307 111.231.95.102:443 ESTABLISHED 22588
TCP 192.168.231.137:2332 118.126.69.64:443 ESTABLISHED 22588
TCP 192.168.231.137:2400 10.23.24.4:3128 ESTABLISHED 22588
TCP 192.168.231.137:2405 10.23.24.4:3128 ESTABLISHED 22588
TCP 192.168.231.137:2459 10.23.24.4:3128 ESTABLISHED 22588
TCP 192.168.231.137:2460 10.23.24.4:3128 ESTABLISHED 22588
TCP 192.168.231.137:2461 10.23.24.4:3128 ESTABLISHED 22588
TCP 192.168.231.137:2462 10.23.24.4:3128 ESTABLISHED 22588
TCP 192.168.231.137:2463 10.23.24.4:3128 ESTABLISHED 22588
netstat -ano | findStr [端口号]
查看某个端口被哪个进程占用
netstat -ano | findStr 2436
TCP 127.0.0.1:2436 127.0.0.1:9999 ESTABLISHED 22588
TCP 127.0.0.1:9999 127.0.0.1:2436 ESTABLISHED 12308
这里pid为22588的进程和pid为12308建立了本地tcp连接,分别占用了端口2436和9999,第四列是tcp的状态,参考https://www.cnblogs.com/jessezeng/p/5617105.html