中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-15 17:06
47,813 topics / 349,903 posts / today 1 new / 48,257 members
DOS疑难解答 & 问题讨论 (解答室) » How to use the Echo command to write the ">" symbol into a text?
Printable Version  1,683 / 9
Floor1 pzf2008 Posted 2009-03-16 06:31
新手上路 Posts 13 Credits 16
@echo off
echo.%%1^>>11.bat
echo.pause

In the original code, to output the `>` symbol correctly in the echo command, you need to use `^>` to escape it. So the modified code for echoing `%1>` into 11.bat is `echo.%%1^>>11.bat`.
Floor2 Climbing Posted 2009-03-17 02:31
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
This depends on whether it is a pure DOS environment or a CMD environment. If it is a CMD environment, you only need to add ^ before >. For example:
echo %%1^>>11.bat

And if it is a pure DOS environment, obviously the above method won't work. A relatively simple method is to borrow the prompt $g character escape function. I don't remember the detailed usage very well (because I rarely use it). You can search for old posts before. I remember that willsort once had a post that systematically discussed this problem. There should be a link in the top essence post summary of this version.

[ Last edited by Climbing on 2009-3-19 at 03:09 ]
Floor3 ben1314 Posted 2009-03-18 22:05
初级用户 Posts 16 Credits 25 From 河南新乡
Never used DOS, but often used under CMD
Floor4 dnntgmfd Posted 2009-03-19 01:33
初级用户 Posts 52 Credits 85 From 湘乡
On the second floor,,
In echo %%1^>11.bat, is there still a > needed in front of the ^?
Floor5 Climbing Posted 2009-03-19 03:10
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
It has been corrected on the second floor.
Floor6 pkto Posted 2009-10-07 13:01
初级用户 Posts 62 Credits 62
Thanks, Climbing was worrying about this problem, and it's solved!
Floor7 aktm Posted 2009-10-16 12:47
新手上路 Posts 1 Credits 2
Learning
Floor8 qvbzyx Posted 2009-10-18 18:38
新手上路 Posts 6 Credits 11
Floor9 pkto Posted 2009-10-21 11:37
初级用户 Posts 62 Credits 62
Not only that, if there is a number following =, such as =3, then ^ must be added before 3, expressed as =^3. Hehe, it's very interesting. Similarly, for %, another % must be added, expressed as %%, to output the correct %.
Floor10 yidos2008 Posted 2009-10-21 17:30
新手上路 Posts 7 Credits 19
Seriously, it would be good if someone explained DEBUG. "The problem is it's a bit difficult to learn" I can't understand it.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023