windows 端口被佔用,並殺死進程的方法

netstat -ano | findstr 8081 查詢端口 被什麼進程佔用
tasklist | findstr 2184 根據進程號 查詢任務名稱
taskkill /f /t /im java.exe 殺掉進程java

使用示例:進程

netstat -ano | findstr 8081
TCP 0.0.0.0:8081 0.0.0.0:0 LISTENING 19020
TCP 127.0.0.1:8081 127.0.0.1:57108 ESTABLISHED 19020
TCP 127.0.0.1:57108 127.0.0.1:8081 ESTABLISHED 2184
TCP [::]:8081 [::]:0 LISTENING 19020im

tasklist | findstr 2184
Postman.exe 2184 Console 1 136,892 K查詢

tasklist | findstr 19020
java.exe 19020 Console 1 501,148 K端口

taskkill /f /t /im java.exe
成功: 已終止 PID 5344 (屬於 PID 3088 子進程)的進程。
成功: 已終止 PID 16064 (屬於 PID 5744 子進程)的進程。
成功: 已終止 PID 19176 (屬於 PID 19020 子進程)的進程。
成功: 已終止 PID 5372 (屬於 PID 16552 子進程)的進程。
成功: 已終止 PID 3088 (屬於 PID 9816 子進程)的進程。
成功: 已終止 PID 5744 (屬於 PID 9816 子進程)的進程。
成功: 已終止 PID 19020 (屬於 PID 9816 子進程)的進程。
成功: 已終止 PID 16552 (屬於 PID 9816 子進程)的進程。block

相關文章
相關標籤/搜索