如何只用一行命令杀掉某个端口号的Windows进程?
For use in command line:
1 | for /f "tokens=5" %a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %a |
For use in bat-file:
1 | for /f "tokens=5" %%a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %%a |
If you want to do it in a .bat, replace %a for %%