China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-20 07:42
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to output <%const a="b"%> with a batch file View 939 Replies 5
Original Poster Posted 2010-04-01 18:46 ·  中国 广东 深圳 电信
初级用户
Credits 59
Posts 27
Joined 2005-12-09 17:52
20-year member
UID 46796
Status Offline
How do I use a batch file to output <%a="b"%>

Using
echo <%%const a="b"%%>>>c:\a.asp
gives an error.
But if I use echo "<%%const a="b"%%>">>c:\a.asp

it gets output as
"<%%const a="b"%%>"


How can I do it without the outermost double quotes?
Floor 2 Posted 2010-04-01 19:47 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
  You must add the escape character ^ before the escape character ^, the concatenation character &, the pipe character |, the input redirection character <, and the output redirection characters > and >>.
Floor 3 Posted 2010-04-02 09:25 ·  中国 广东 深圳 电信
初级用户
Credits 59
Posts 27
Joined 2005-12-09 17:52
20-year member
UID 46796
Status Offline
Fixed. But I solved it by writing it on separate lines.
If I want to write it on one line, what should I do?
echo ^<%%>>c:\a.asp
echo Const a="b">>c:\a.asp
echo %%^>>>c:\a.asp

Writing it on separate lines like above works. But if I put it all on one line, it doesn't work.

echo ^<%%const a="b"%%^>>>c:\a.asp
Floor 4 Posted 2010-04-02 12:19 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
Running echo ^<%%const a="b"%%^>>>c:\a.asp
in a batch file outputs <%const a="b"%>
How come it doesn't work?
Floor 5 Posted 2010-04-06 10:41 ·  中国 广东 深圳 电信
初级用户
Credits 59
Posts 27
Joined 2005-12-09 17:52
20-year member
UID 46796
Status Offline
Did you try what the poster above said?
Floor 6 Posted 2010-04-06 12:41 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
What system are you running it under?
Forum Jump: