|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『楼 主』:
批处理实现输出退行
使用 LLM 解释/回答一下
怎么写这个文件?
它的目的是,在同一行输出,不另起一行
比如:
echo a >t.txt
那么在t.txt中就有了一行显示了 a
现在问题来了,
echo b >t.txt
b在文件t.txt 中另起了一行,那么怎么做才能让它紧跟着 a 后显示即:
ab
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
|
|
2006-12-24 05:57 |
|
|
9527
银牌会员
     努力做坏人
积分 1185
发帖 438
注册 2006-8-28 来自 北京
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
>>t.txt set/p=a<nul
>>t.txt set/p=b<nul
>>t.txt set/p=a<nul
>>t.txt set/p=b<nul
|

我今后在论坛的目标就是做个超级坏人!!! |
|
2006-12-24 06:15 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
Originally posted by 9527 at 2006-12-23 17:15:
>>t.txt set/p=a<nul
>>t.txt set/p=b<nul
结果不对啊
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.
|
|
2006-12-24 06:32 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
对的啊~你的运行环境是?
Yes, what is your running environment?
|
|
2006-12-24 06:36 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
9527的意思大概是你想追加“什么”,就>>t.txt set/p=”什么“<nul
就可以了。
去掉>>t.txt set/p=a<nul 就只追加 b 了
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".
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-12-24 06:36 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 6 楼』:
回来了
使用 LLM 解释/回答一下
Originally posted by vkill at 2006-12-23 17:36:
对的啊~你的运行环境是?
我是在CMD 命令行下进行的
不知道为什么,进入循环体后,
set /a a+=1
提示语法错误!
请问是为什么?
谢谢
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
|
|
2006-12-24 11:19 |
|
|
hhasee
初级用户
 
积分 185
发帖 88
注册 2008-5-12
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
在纯DOS下运行不成功,能不能提供在纯DOS下的成功代码,在此谢谢了!!
It fails to run under pure DOS. Can you provide the successful code under pure DOS? Thanks here in advance.
|
|
2008-9-19 08:40 |
|
|
terrytong
中级用户
  
积分 240
发帖 115
注册 2008-3-10
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by scriptor at 2006-12-24 05:57:
怎么写这个文件?
它的目的是,在同一行输出,不另起一行
比如:
echo a >t.txt
那么在t.txt中就有了一行显示了 a
现在问题来了,
echo b >t.txt
b在 ...
你用>的话,a 会被删除掉,只会显示b.如果你想显示ab的话,直接用echo ab>t.txt不就得了?
二楼的没有问题的。
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.
|
|
2008-9-19 09:34 |
|
|
wxcute
中级用户
  
积分 458
发帖 211
注册 2006-7-26
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
楼主的意思可能是
原来有文件
第一行:a
第二行:(空)
要求追回输出字符串"b"到a后面,就要把第二行删除掉。
即原来就有一个文件或是另一段代码已经生成了那个文件。
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.
|

┌───────┐
├→学习→实践→┤
└───────┘ |
|
2008-9-19 12:48 |
|
|
radem
高级用户
    CMD感染者
积分 691
发帖 383
注册 2008-5-23
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
我认为楼主的echo a >t.txt后没有第2行(空)
想在echo b >t.txt后也不产生第2行
而是在原来的a同行加上b
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.
|

 |
|
2008-9-19 20:18 |
|