TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 3808
How to kill this process with pid?
my command:
for /f "delims=, tokens=5" %%a in ('netstat -ano | findstr 0.0.0.0:8080') do ( taskkill /f /pid %%a )
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 3808
How to kill this process with pid?
my command:
for /f "delims=, tokens=5" %%a in ('netstat -ano | findstr 0.0.0.0:8080') do ( taskkill /f /pid %%a )
You are close! You're missing that the pipe character |
has to be escaped in batch using a caret ^
and that the arguments (delims
and tokens
) are not separated by a ,
. Actually you can leave delims out completely.
So in total your command would look like this:
for /f "tokens=5" %%a in ('netstat -ano ^| findstr 0.0.0.0:8080') do (taskkill /f /pid %%a)