How can you run a batch file that sets all the other cmd.exe that are currently running, except for the one that executes the kill command?
Combining these two threads:
you can write something like this in a simple akillfile.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%^"
copy cmd.exe, rename it to a.exe, then use this command in the batch file: run a.exe / k taskkill / f / im cmd.exe