How delayed expansion works?
Posted: 13 Jun 2020 06:05
According the parsing rules (https://stackoverflow.com/questions/409 ... ts/4095133) is following explanation correct?
Code: Select all
set "a=xyz"
echo "a: !a!"
set "b=^!a^!"
echo "b: !b!"
rem Output: "b: !a!" - Only Delayed expansion
echo "b percent: %b%"
rem echo "b percent: !a!" - Percent expansion takes place expands %b% to !a!
rem "b percent: xyz" - Then delayed expansion takes place and expand !a! to xyz
rem Finally echo xyz executes