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?
See Question&Answers more detail:osHow 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?
See Question&Answers more detail:osCombining these 2 threads:
you can write down something like this in a simple cmd file (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%^"