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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -