📜  杀死占用端口窗口 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:39.531000             🧑  作者: Mango

代码示例1
// Option 1: if you have npm@5.2.0^ version
npx kill-port 8080

// Linux
kill -9 $(lsof -t -i tcp:8080)

// Windows command line:
for /f "tokens=5" %a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %a

// Windows bat-file:
for /f "tokens=5" %%a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %%a