batch file write <> to text file

北战南征 提交于 2019-12-05 19:54:59
echo ^<br^>

Circumflex is the escape character in DOS/Win command line.

SilverbackNet has the correct answer for escaping special characters like < and >. But it might be more convenient to establish a variable containing the HTML tag. Special characters do not need to be escaped if they are quoted or expanded using delayed expansion. The definition uses quotes, and the expansion uses delayed expansion.

Using the variable only becomes an advantage when you need to write the tag in multiple places.

set "br=<br>"
....
echo !br! %var17% >>Runfiles\temporary2.txt
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!