Last active
February 29, 2016 16:13
-
-
Save binki/ab767e2128e1bc6b1ac0 to your computer and use it in GitHub Desktop.
Undelayed expansion use case?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SETLOCAL | |
CALL test.cmd | |
IF ERRORLEVEL 1 ( | |
SET TESTRET=1 | |
) ELSE ( | |
: # Do something with some envvars that test.cmd set that | |
: # we want to protect our own cmd code from. | |
) | |
: # Rely on undelayed expansion semantics to communicate variables | |
: # out of the SETLOCAL/ENDLOCAL :-D. Though, I suspect that if | |
: # the variable contains a closing paren, this’ll break. | |
IF 0 == 0 ( | |
ENDLOCAL | |
SET TESTRET=%TESTRET% | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment