Search code examples
stringbatch-fileecho

how to remove the double quotes in output when i use echo command with "< >" (these charaters) in the string?


I wish to create a required no. of html divisions each with a different id (a series).

but when I write in a loop

echo "<div id=%prefix%%i%> %innerHTML% </div>" >> file.txt

It should be like

  <div id=a1> x </div>
  <div id=a2> x </div>
  <div id=a3> x </div>

but it comes out to be

  "<div id=a1> x </div>"
  "<div id=a2> x </div>"
  "<div id=a3> x </div>"

I have tried omitting the double quotes "" but then it throws an error due to the use of '>' (used to write in a file)

help me with this


Solution

  • echo ^<escape them^>
    

    this works absolutely fine.

    echo ^<div id=%prefix%%i%^> %innerHTML% ^</div^> >> file.txt