How to find which program is using a Port in Windows and stop it

Configurare noua (How To)

Situatie

The “port already in use” error is common with web servers, databases and development tools. The fix is to identify the process that holds the port.

Solutie

  1. Press the Windows key, type cmd, right-click Command Prompt and select Run as administrator.
  2. Search for the port you need (example for 8080):
netstat -ano | findstr :8080
  1. In the output, the last column is the PID of the process (for example 4812).
  2. Find the name of the process:
tasklist /FI "PID eq 4812"
  1. If the process can be safely stopped, terminate it:
taskkill /PID 4812 /F
  1. Run the command from step 2 again. If nothing is returned, the port is free.

PowerShell alternative:

Get-NetTCPConnection -LocalPort 8080 | Select-Object LocalPort, State, OwningProcess
Get-Process -Id 4812

Warning: do not terminate system processes (such as System or svchost.exe) unless you know which services run inside them. If the port is held by a Windows service, stop the service from services.msc instead.

Tip solutie

Permanent

Voteaza

(3 din 7 persoane apreciaza acest articol)

Despre Autor

Cel Mai Apreciat Autor

Leave A Comment?