Why does the following Windows Batch File output Foo
followedby Bar
, rather than Baz
?
@echo off
setlocal
set _=Foo
echo %_%
set _=Bar
if 1==1 (
set _=Baz
echo %_%
)
The output on my system (Microsoft Windows XP [Version 5.1.2600]) is:
Foo
Bar
If I remove the conditional statement, the expected output of Foo
and Baz
is observed.