1、查看端口号被占用的进程 :netstat -ano | findstr "XXXX"
(注XXXX是你想要看查看的端口号)
C:\Users\admin>netstat -ano | findstr "1099"
TCP 0.0.0.0:1099 0.0.0.0:0 LISTENING 17192
TCP [::]:1099 [::]:0 LISTENING 17192
具体对应的列是:协议 本地地址 外部地址 状态 PID
协议 | 本地地址 | 外部地址 | 状态 | PID |
---|---|---|---|---|
TCP | 0.0.0.0:1099 | 0.0.0.0:0 | LISTENING | 17192 |
2、PID查看具体进程名:tasklist | findstr "XXXX"
(注 XXXX是进程的id即PID)
C:\Users\admin>tasklist | findstr "17192"
java.exe 17192 Console 8 25,532 K
3、根据PID杀死进程:taskkill /f /pid "XXXX"
(注 XXXX是进程的id即PID)
C:\Users\admin>taskkill /f /pid 17192
成功: 已终止 PID 为 17192 的进程。