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-08-15 14:27
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How to use the Echo command to write the ">" symbol into a text? View 1,681 Replies 9
Original Poster Posted 2009-03-16 06:31 ·  中国 北京 联通
新手上路
Credits 16
Posts 13
Joined 2008-12-08 09:41
17-year member
UID 133204
Gender Male
Status Offline
@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`.
Floor 2 Posted 2009-03-17 02:31 ·  中国 河北 保定 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
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 ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
pzf2008 +1 2009-03-17 05:53
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 3 Posted 2009-03-18 22:05 ·  中国 河南 新乡 电信
初级用户
Credits 25
Posts 16
Joined 2007-10-27 16:01
18-year member
UID 100933
Gender Male
From 河南新乡
Status Offline
Never used DOS, but often used under CMD
Floor 4 Posted 2009-03-19 01:33 ·  中国 广东 电信
初级用户
★★
Credits 85
Posts 52
Joined 2009-01-10 18:22
17-year member
UID 136322
Gender Male
From 湘乡
Status Offline
On the second floor,,
In echo %%1^>11.bat, is there still a > needed in front of the ^?
Floor 5 Posted 2009-03-19 03:10 ·  中国 河北 保定 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
It has been corrected on the second floor.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 6 Posted 2009-10-07 13:01 ·  中国 江苏 南京 电信
初级用户
★★
Credits 62
Posts 62
Joined 2007-07-14 14:39
19-year member
UID 93962
Gender Male
Status Offline
Thanks, Climbing was worrying about this problem, and it's solved!
Floor 7 Posted 2009-10-16 12:47 ·  中国 北京 北京互联通网络科技有限公司
新手上路
Credits 2
Posts 1
Joined 2009-10-15 14:13
16-year member
UID 153115
Gender Male
Status Offline
Learning
Floor 8 Posted 2009-10-18 18:38 ·  中国 湖北 武汉 电信
新手上路
Credits 11
Posts 6
Joined 2009-10-03 13:40
16-year member
UID 152570
Gender Male
Status Offline
Floor 9 Posted 2009-10-21 11:37 ·  中国 江苏 南京 电信
初级用户
★★
Credits 62
Posts 62
Joined 2007-07-14 14:39
19-year member
UID 93962
Gender Male
Status Offline
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 %.
Floor 10 Posted 2009-10-21 17:30 ·  中国 广东 东莞 电信
新手上路
Credits 19
Posts 7
Joined 2008-10-10 09:08
17-year member
UID 127954
Gender Male
Status Offline
Seriously, it would be good if someone explained DEBUG. "The problem is it's a bit difficult to learn" I can't understand it.
Forum Jump: