I recently ran a 3rd party script that ran "cmd" inside of it, thus increasing the nesting depth of my cmd window (making my history and DOSKey macros unavailable in the process). So I was wondering if there's an equivalent of $SHLVL or some other way to determine this situation? I suppose I could just up-arrow to see if my history is still there, but someday I might need this from a script.
There does not appear to be anything different when I review the output of "set". Thanks!
EDIT Changed code to list PIDs.
Edit 2 Changed code to output the level as
%errorlevel%
See https://docs.microsoft.com/en-us/windows/console/getconsoleprocesslist
CountConsoleProcess.vb
CountConsoleProcess.bat
ConsoleTest.Bat
And to use (after doing a
cmd /k
so their are two CMDs running). The first is the current PID.And to add the current folder to the path
_AddThisFolderToPath.bat