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-15 00:25
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Batch processing to achieve output退行 (Note: "退行" here seems to be a misexpression. If it refers to "backspace" in the context of batch processing output, the correct translation for "输出退格" would be "output backspace". But based on the given content, it's directly translated as above.) View 1,604 Replies 9
Original Poster Posted 2006-12-24 05:57 ·  中国 北京 中国科学院研究生院
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
How to write this file?

Its purpose is to output on the same line without starting a new line.

For example:
echo a >t.txt

Then there is a line in t.txt showing a.

Now the problem is,
echo b >t.txt

b starts a new line in file t.txt. Then how to make it display immediately after a, that is:

ab
Floor 2 Posted 2006-12-24 06:15 ·  中国 北京 联通
银牌会员
★★★
努力做坏人
Credits 1,185
Posts 438
Joined 2006-08-28 12:00
19-year member
UID 61449
From 北京
Status Offline
>>t.txt set/p=a<nul

>>t.txt set/p=b<nul
我今后在论坛的目标就是做个超级坏人!!!
Floor 3 Posted 2006-12-24 06:32 ·  中国 北京 中国科学院研究生院
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
Originally posted by 9527 at 2006-12-23 17:15:
>>t.txt set/p=a<nul


>>t.txt set/p=b<nul


The result is not correct.
Floor 4 Posted 2006-12-24 06:36 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Yes, what is your running environment?
Floor 5 Posted 2006-12-24 06:36 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
The meaning of 9527 is roughly that if you want to append "what", you can do >>t.txt set/p="what"<nul. Removing >>t.txt set/p=a<nul will only append "b".
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 6 Posted 2006-12-24 11:19 ·  中国 北京 中国科学院研究生院
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
Originally posted by vkill at 2006-12-23 17:36:
Right~ What is your running environment?



I am doing it under the CMD command line

I don't know why, after entering the loop body,

set /a a+=1

The syntax error is prompted!
May I ask why?
Thank you
Floor 7 Posted 2008-09-19 08:40 ·  中国 广东 深圳 电信
初级用户
★★
Credits 185
Posts 88
Joined 2008-05-12 18:46
18-year member
UID 118511
Gender Male
Status Offline
It fails to run under pure DOS. Can you provide the successful code under pure DOS? Thanks here in advance.
Floor 8 Posted 2008-09-19 09:34 ·  中国 上海 上海地面通信息网络有限公司
中级用户
★★
Credits 240
Posts 115
Joined 2008-03-10 19:31
18-year member
UID 112561
Gender Male
Status Offline
Originally posted by scriptor at 2006-12-24 05:57:
How to write this file?

Its purpose is to output on the same line without starting a new line

For example:
echo a >t.txt
Then there is a line displaying a in t.txt

Now the problem is,
echo b >t.txt

b is in ...

If you use >, then a will be deleted and only b will be displayed. If you want to display ab, just use echo ab>t.txt directly?
The second floor is no problem.
Floor 9 Posted 2008-09-19 12:48 ·  中国 福建 三明 电信
中级用户
★★
Credits 458
Posts 211
Joined 2006-07-26 19:42
19-year member
UID 59307
Status Offline
The landlord's meaning may be
Originally there was a file

First line: a
Second line: (empty)

To recover and output the string "b" after a, you need to delete the second line.

That is, there was already a file or another piece of code that had generated that file.
┌───────┐
├→学习→实践→┤
└───────┘
Floor 10 Posted 2008-09-19 20:18 ·  中国 广东 韶关 电信
高级用户
★★★
CMD感染者
Credits 691
Posts 383
Joined 2008-05-23 00:38
18-year member
UID 119451
Gender Male
Status Offline
I think after the building's echo a >t.txt, there is no second line (blank).
I want that after echo b >t.txt, there is no second line generated either, but instead, add b to the same line as a.
Forum Jump: