Created
September 10, 2019 15:42
-
-
Save farshidrezaei/1e288ae963dc7cffed52b568031dfc1c to your computer and use it in GitHub Desktop.
Bat file for kill and stop a port or process.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
cls | |
:loop | |
cls | |
:enterPort | |
cls | |
set /P port="Enter a port. [ q => exit ] : " | |
If "%port%"=="q" goto endLoop | |
cls | |
echo. | |
echo. | |
echo List of Process that contains the "%port%" string . find the process that you want. | |
echo. | |
netstat -aon | findstr i | |
echo. | |
netstat -aon | findstr %port% | |
echo. | |
echo. ------------------------- | |
echo. | |
echo (*the last number is process id.) | |
echo. | |
set /P processId="Enter Process id to kill. [ b => back , q => exit ] : " | |
If "%processId%"=="b" goto enterPort | |
If "%processId%"=="q" goto endLoop | |
taskkill /F /PID %ProcessId% | |
goto loop | |
:endLoop | |
cls | |
echo. | |
echo. | |
echo by FarshidRezaei - github : https://github.com/farshidrezaei | |
echo. | |
echo. | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment