This batch script:
outputs the counterintuitive result:
...but if the parens are removed, it outputs the expected result:
Why do the parens make a difference?
GD
Code:
@echo off
setlocal
goto :main
:sub1
echo in sub1
set sub1_called=WAS
goto :eof
:main
set sub1_called=WAS NOT
(
call :sub1
echo sub1 %sub1_called% called
)
Code:
in sub1
sub1 WAS NOT called
Code:
in sub1
sub1 WAS called
GD