Описание тега delayedvariableexpansion
Delayed variable expansion causes a Windows batch file to evaluate variables at run time instead of parse time.
Variables in a Windows batch files are normally evaluated when the script is parsed. With delayed variable expansion, variables are evaluated at execution time instead. This is especially useful in FOR loops. To turn on, use setlocal EnableDelayedExpansion
. To turn off, setlocal DisableDelayedExpansion
.