From a batch file, you can determine if CMD.EXE or Take Command is loaded by testing for the variable function @EVAL, with a test like this:
if "%@eval[2 + 2]%" == "4" echo CMD.EXE is loaded!
This test can never succeed in CMD.EXE. Other variable functions could be used for the same purpose.