中国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-29 09:42
47,816 topics / 349,916 posts / today 0 new / 48,265 members
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.)
Printable Version  1,703 / 9
Floor1 scriptor Posted 2006-12-24 05:57
银牌会员 Posts 555 Credits 1,187
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
Floor2 9527 Posted 2006-12-24 06:15
银牌会员 Posts 438 Credits 1,185 From 北京
>>t.txt set/p=a<nul

>>t.txt set/p=b<nul
Floor3 scriptor Posted 2006-12-24 06:32
银牌会员 Posts 555 Credits 1,187
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.
Floor4 vkill Posted 2006-12-24 06:36
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
Yes, what is your running environment?
Floor5 ccwan Posted 2006-12-24 06:36
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
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".
Floor6 scriptor Posted 2006-12-24 11:19
银牌会员 Posts 555 Credits 1,187
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
Floor7 hhasee Posted 2008-09-19 08:40
初级用户 Posts 88 Credits 185
It fails to run under pure DOS. Can you provide the successful code under pure DOS? Thanks here in advance.
Floor8 terrytong Posted 2008-09-19 09:34
中级用户 Posts 115 Credits 240
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.
Floor9 wxcute Posted 2008-09-19 12:48
中级用户 Posts 211 Credits 458
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.
Floor10 radem Posted 2008-09-19 20:18
高级用户 Posts 383 Credits 691
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.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023