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

后端 未结 20 2068
陌清茗
陌清茗 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:27

    In Windows PowerShell version 1 or later to stop a process on port 3000 type:

    Stop-Process (,(netstat -ano | findstr :3000).split() | foreach {$[$.length-1]}) -Force


    As suggested by @morganpdx here`s a more PowerShell-ish, better version:

    Stop-Process -Id (Get-NetTCPConnection -LocalPort 3000).OwningProcess -Force

提交回复
热议问题