write file with setlocal enableDelayedExpansion error -
i want script write file output:
rem ===[a]==========[b]==========[c] # =========[d]==========[e]==========[f] # =========[g]==========[h]==========[i] set "a1= " & set "b1= " & set "c1= " # & set "d1= " & set "e1= " & set "f1= " # & set "g1= " & set "h1=5" & set "i1= "
in case want use enabledelayedexpansion
wrote script:
setlocal enabledelayedexpansion set file="test.bat" echo rem ===[a]==========[b]==========[c] # =========[d]==========[e]==========[f] # =========[g]==========[h]==========[i] >> %file% echo set "a1= " ^^& set "b1= " ^^& set "c1= " # ^^& set "d1= " ^^& set "e1= " ^^& set "f1= " # ^^& set "g1= " ^^& set "h1=5" ^^& set "i1= " >> %file%
but output 1 line:
rem ===[a]==========[b]==========[c] # =========[d]==========[e]==========[f] # =========[g]==========[h]==========[i]
how can make output want enabledelayedexpansion ?
use 1 single ^
rather 2 when escaping special characters. change last line in script to:
echo set "a1= " ^& set "b1= " ^& set "c1= " # ^& set "d1= " ^& set "e1= " ^& set "f1= " # ^& set "g1= " ^& set "h1=5" ^& set "i1= " >> %file%
Comments
Post a Comment