I meet a problem about batch in windows. The following codes can run well in a bat file.
set word1=
set word2=
set str=I0338092020061201B.zip.Z
call set str=%%str:2006=%word1%%%
call set str=%%str:B.zip.Z=%word2%%%
echo %str%
But the problem is when the codes embedded into the loop, the parameter str return null.
set word1=
set word2=
For /R %cd%\FX\ %%G IN (*.txt) do (
Echo "%%G"
set str=IXXXXX2020061201B.zip
call set str=%%str:2006=%word1%%%
call set str=%%str:B.zip=%word2%%%
echo %str%
timeout 1
)
Is there any method to cover that, and why it happened this way. Thanks a lot.