How do I kill the process currently using a port on localhost in Windows?

后端 未结 20 2391
陌清茗
陌清茗 2020-11-22 11:37

How can I remove the current process/application which is already assigned to a port?

For example: localhost:8080

20条回答
  •  借酒劲吻你
    2020-11-22 12:25

    For use in command line:

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

    For use in bat-file:

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

提交回复
热议问题