How can you run a batch file which taskkills all other cmd.exes which are currently running, except for the one that is doing the task kill command?
Combining these 2 threads:
you can write down something like this in a simple cmd file (akillfile.cmd)
akillfile.cmd
title=dontkillme FOR /F "tokens=2 delims= " %%A IN ('TASKLIST /FI ^"WINDOWTITLE eq dontkillme^" /NH') DO SET tid=%%A echo %tid% taskkill /F /IM cmd.exe /FI ^"PID ne %tid%^"
2.1m questions
2.1m answers
60 comments
57.0k users