This relates to my thread Pass the PID from tasklist into taskkill to kill a process by the .dlls it's holding open.
I am trying to do something like what was discussed in that thread:
FOR /F "usebackq tokens=2 skip=2" %i IN (`tasklist |findstr /r "[0-9].exe") DO taskkill /PID %i
The above command does not run. I want to get all processes which are like 123456.exe
and kill them. What am I doing wrong?
Best Answer
You'll need to make a couple of changes to make it work. This example as you want:
Your code:
Why your code was failing:
You can find some excellent script examples at Rob Vanderwoude's and Timo Salmi's sites: