4
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 )
Cœur
  • 37,241
  • 25
  • 195
  • 267
G.Fei
  • 43
  • 2

1 Answers1

5

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)
Rodia
  • 1,407
  • 8
  • 22
  • 29
geisterfurz007
  • 5,292
  • 5
  • 33
  • 54