I met a weird problem during write some Windows batch script: the iterator value %%X
got changed between echo
and set
in the for loop. Here is the code:
@echo off
for %%x in (%*) do (
echo %%x
set path1=%%x
echo %path1%
)
@echo on
when invoke this script:
c:\> test.bat aaa bbb
the result is:
aaa
bbb
bbb
bbb
the first bbb
is %path1%
. Could not understand why this value is different from %%X
Could anyone help? Thanks.