Description: | The question is: When localizing a function via SETLOCAL and ENDLOCAL, how to return a value
that was calculated before executing ENDLOCAL when ENDLOCAL restores all variables
back to its original state?
The answer comes with "variable expansion". The command processor expands all variables of a command before executing the command. Letting the command processor executing ENDLOCAL and a SET command at once solves the problem. Commands can be grouped within brackets. |
||
Script: | Download: BatchTutoFunc5.bat
|
||
Script Output: |
|