This way, if your batch file fails and trashes your environment, you can simply return to the clean environment by typing "exit".
Also, you might want to test the script from within environments with variable expansion enabled or disabled, etc.
If you're like me and have several cmd shell windows open, and multiple sub-shells open within each, like russian dolls, it is very easy to get lost and not remember which shell is which.
Here comes subcmd.bat. A very simple script that changes the cmd prompt, to display the russian doll index, and the extension and expansion modes.
Ex:
Code: Select all
C:\JFL\Temp>subcmd
#2 E:on V:off C:\JFL\Temp>set "X=1"
#2 E:on V:off C:\JFL\Temp>subcmd /V:on
#3 E:on V:on C:\JFL\Temp>set "X=2"
#3 E:on V:on C:\JFL\Temp>subcmd /E:off
#4 E:off V:on C:\JFL\Temp>set "X=3"
The syntax of the command is incorrect.
#4 E:off V:on C:\JFL\Temp>set X=3
#4 E:off V:on C:\JFL\Temp>exit
#3 E:on V:on C:\JFL\Temp>echo !X!
2
#3 E:on V:on C:\JFL\Temp>exit
#2 E:on V:off C:\JFL\Temp>echo !X!
!X!
#2 E:on V:off C:\JFL\Temp>echo %X%
1
#2 E:on V:off C:\JFL\Temp>exit
C:\JFL\Temp>echo %X%
%X%
C:\JFL\Temp>
Available there:
https://github.com/JFLarvoire/SysToolsL ... subcmd.bat
Run subcmd /? to get a help message with a list of options.
Enjoy!
Jean-François