Expanding environment variables for the command line
I would like to run cmd.exe, which will evaluate environment variables at the time of the call, not when it parses the command. If I set BASE to 2 and repeat it, I should see number 2, although running this script does not correctly set the base.
Expected Behavior:
C:\Users\schristo>cmd.exe /X /C "set BASE=2 && echo %BASE% && pause"
2
Press any key to continue . . .
Actual behavior:
C:\Users\schristo>cmd.exe /X /C "set BASE=2 && echo %BASE% && pause"
%BASE%
Press any key to continue . . .
+3
source to share