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-12 05:03
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Solved] How to make echo A>A.txt output a 1-byte file View 848 Replies 3
Original Poster Posted 2009-06-05 06:23 ·  中国 吉林 延边朝鲜族自治州 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
As titled: how can I make the file output by echo A>A.txt be 1 byte?

The file output by echo A>A.txt is 3 bytes
The file output by echo 1 >A.txt is 4 bytes
The file output by echo 2 >A.txt is 4 bytes

Every file output by echo appends carriage return and line feed, and outputting 1 or 2 into the text even makes it 4 bytes. How can I make the text output this way be only 1 byte?

[ Last edited by Hanyeguxing on 2009-6-5 at 06:58 ]
Floor 2 Posted 2009-06-05 06:26 ·  中国 江西 赣州 电信
银牌会员
★★★★
Credits 2,025
Posts 1,122
Joined 2007-09-05 20:15
18-year member
UID 96653
Gender Male
Status Offline
Floor 3 Posted 2009-06-05 06:30 ·  中国 北京 联通
银牌会员
★★★
Credits 2,098
Posts 566
Joined 2007-09-11 07:27
18-year member
UID 97070
Gender Male
Status Offline
echo A includes the letter A, carriage return, and line feed, so it is 3 bytes. For the correct answer, see reply #2.
Floor 4 Posted 2009-06-05 06:57 ·  中国 吉林 延边朝鲜族自治州 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
Originally posted by tireless at 2009-6-5 06:26:
set/p=A<nul>a.txt

[ Last edited by tireless on 2009-6-5 at 06:34 ]


You can tell at a glance, but how come I just didn't think of this?

I kept trying to find a way around echo... embarrassing.
Forum Jump: