中国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-12 03:17
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Solved] How to make echo A>A.txt output a 1-byte file
Printable Version  847 / 3
Floor1 Hanyeguxing Posted 2009-06-05 06:23
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
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 ]
Floor2 tireless Posted 2009-06-05 06:26
银牌会员 Posts 1,122 Credits 2,025
Floor3 s11ss Posted 2009-06-05 06:30
银牌会员 Posts 566 Credits 2,098
echo A includes the letter A, carriage return, and line feed, so it is 3 bytes. For the correct answer, see reply #2.
Floor4 Hanyeguxing Posted 2009-06-05 06:57
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
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.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023