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

 



@echo off
set /p id="Enter PORT: "
FOR /F "tokens=5 delims= " %%P IN ('netstat -a -n -o ^| findstr :%id%') DO taskkill /PID %%P /F
netstat -ano | findstr %id%
pause


Save As bat file (portkill.bat) and then run the file.


Post a Comment

Previous Post Next Post