|
junyee
中级用户
  
积分 253
发帖 112
注册 2006-5-31
状态 离线
|
『楼 主』:
能否一个echo 多行输出?
使用 LLM 解释/回答一下
echo 1》test.txt
echo 2>> test.txt
echo 3>> test.txt
能否把上面的精简下。。要求只使用一个echo,能办到吗?
怀疑
echo (
1
2
3
)>test.txt
可是不行。。。
echo (1&2&3)>test.txt
|
|
2007-11-26 10:36 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
下面代码另存为echo2.cmd
@echo off
:start_echo
set start_echo=%1
if not defined start_echo goto end
echo %1
shift
goto start_echo
:end
在执行
echo2 abc def ghi
或者echo2 abc def ghi>test.txt
The following code is saved as echo2.cmd
@echo off
:start_echo
set start_echo=%1
if not defined start_echo goto end
echo %1
shift
goto start_echo
:end
When executing
echo2 abc def ghi
or echo2 abc def ghi>test.txt
|

第一高手 第二高手
我的小站
 |
|
2007-11-26 11:13 |
|
|
junyee
中级用户
  
积分 253
发帖 112
注册 2006-5-31
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
感谢楼上的热心,可惜不是我想要的结果~
这个也能实现
@echo off
set /p input=
for %%a in (%input%) do echo %%a>>test.txt
我就想问一下,echo是否存在这样的功能,一个命令输出多行
另:好少见shift的应用。。。
Last edited by junyee on 2007-11-26 at 11:28 AM ]
Thanks to the enthusiasm of the person above, but unfortunately it's not the result I wanted~
This can also be achieved
@echo off
set /p input=
for %%a in (%input%) do echo %%a>>test.txt
I just want to ask if echo has such a function, a single command to output multiple lines
Also: It's rare to see the application of shift...
Last edited by junyee on 2007-11-26 at 11:28 AM ]
|
|
2007-11-26 11:27 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
不依赖echo2.cmd,除了for没有其他办法
echo2.cmd比你这个用起来放便呀
echo2 第1行内容 (空格)第2行内容 (空格)第3行内容.....
No reliance on echo2.cmd, there's no other way except for
echo2.cmd is more convenient to use than yours
echo2 line 1 content (space) line 2 content (space) line 3 content.....
|

第一高手 第二高手
我的小站
 |
|
2007-11-26 11:35 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
    『第 5 楼』:
使用 LLM 解释/回答一下
E:\Cmd>type xecho.bat
@echo this is the first line for echo^
this is the second line^
the end
E:\Cmd>xecho.bat
this is the first line for echo
this is the second line
the end
E:\Cmd>
E:\Cmd>type xecho.bat
@echo this is the first line for echo^
this is the second line^
the end
E:\Cmd>xecho.bat
this is the first line for echo
this is the second line
the end
E:\Cmd>
|
|
2007-11-26 12:19 |
|
|
ldd600
新手上路

积分 6
发帖 3
注册 2007-9-28
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
楼上的厉害啊,
原来行尾加个 ^ ,下面再空一行就可以了。
试过了还不错。
Wow, the person upstairs is really good!
It turns out that adding a ^ at the end of the line and then leaving a blank line below works.
I tried it and it's pretty good.
|
|
2007-11-26 18:58 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
lxmxn斑竹能否解释下原理?
Can moderator lxmxn explain the principle?
|
|
2007-11-27 01:23 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
^出现第一次时候表示 转义后面的字符
^When it first appears, it means to escape the following character
|
|
2007-11-27 01:46 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
下一行也算后面的字符?
Does the next line also count as subsequent characters?
|
|
2007-12-22 20:57 |
|
|
wuxj
初级用户
 
积分 50
发帖 25
注册 2007-3-29
状态 离线
|
|
2007-12-23 02:34 |
|
|
zyz0304360
中级用户
   稳
积分 257
发帖 123
注册 2008-1-5 来自 烟台
状态 离线
|
|
2008-1-15 13:11 |
|
|
kidzgy
中级用户
  
积分 262
发帖 129
注册 2007-7-11
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
版主,如果多行中间需要用空格空的呢?怎么办?
Moderator, if there are multiple lines and spaces are needed in the middle, how to do it?
|
|
2008-1-15 18:54 |
|
|
tempuser
高级用户
   
积分 547
发帖 261
注册 2006-4-15
状态 离线
|
『第 13 楼』:
没有换行呀
使用 LLM 解释/回答一下
echo2 123 456 789
没有实现
123
456
789
显示效果呀!
echo2 123 456 789
Not implemented
123
456
789
Display effect!
|
|
2008-1-16 17:07 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
Originally posted by kidzgy at 2008-1-15 18:54:
版主,如果多行中间需要用空格空的呢?怎么办?
B:\PERL>type xecho.bat
@echo one^
^
^
the end^
goodbye
B:\PERL>xecho.bat
one
the end goodbye
B:\PERL>
Originally posted by kidzgy at 2008-1-15 18:54:
Moderator, if there are multiple lines and spaces are needed in the middle, what should be done?
B:\PERL>type xecho.bat
@echo one^
^
^
the end^
goodbye
B:\PERL>xecho.bat
one
the end goodbye
B:\PERL>
|
|
2008-1-18 01:22 |
|
|
shi1035
新手上路

积分 7
发帖 4
注册 2007-7-28
状态 离线
|
|
2008-1-18 09:29 |
|