|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『楼 主』:
echo命令的用法你知多少?
使用 LLM 解释/回答一下
ECHO命令的使用
ECHO命令是大家都熟悉的DOS批处理命令的一条子命令,但它的一些功能和用法也许你并不是全都知道,不信你瞧:
1. 作为控制批处理命令在执行时是否显示命令行自身的开关
格式:ECHO
如果想关闭“ECHO OFF”命令行自身的显示,则需要在该命令行前加上“@”。
2. 显示当前ECHO设置状态
格式:ECHO
3. 输出提示信息
格式:ECHO信息内容
上述是ECHO命令常见的三种用法,也是大家熟悉和会用的,但作为DOS命令淘金者你还应该知道下面的技巧:
4. 关闭DOS命令提示符
在DOS提示符状态下键入ECHO OFF,能够关闭DOS提示符的显示使屏幕只留下光标,直至键入ECHO ON,提示符才会重新出现。
5. 输出空行,即相当于输入一个回车
格式:ECHO.
值得注意的是命令行中的“.”要紧跟在ECHO后面中间不能有空格,否则“.”将被当作提示信息输出到屏幕。另外“.”可以用,:;”/+等任一符号替代。
在下面的例子中ECHO.输出的回车,经DOS管道转向作为TIME命令的输入,即相当于在TIME命令执行后给出一个回车。所以执行时系统会在显示当前时间后,自动返回到DOS提示符状态:
C:>ECHO.|TIME
ECHO命令输出空行的另一个应用实例是:将ECHO.加在自动批处理文件中,使原本在屏幕下方显示的提示画面,出现在屏幕上方。
6. 答复命令中的提问
格式:ECHO答复语|命令文件名
上述格式可以用于简化一些需要人机对话的命令(如:CHKDSK/F;FORMAT Drive:;del *.*)的操作,它是通过DOS管道命令把ECHO命令输出的预置答复语作为人机对话命令的输入。下面的例子就相当于在调用的命令出现人机对话时输入“Y”回车:
C:>ECHO Y|CHKDSK/F
C:>ECHO Y|DEL A :*.*
7. 建立新文件或增加文件内容
格式:ECHO 文件内容>文件名
ECHO 文件内容>>文件名
例如:C:>ECHO @ECHO OFF>AUTOEXEC.BAT建立自动批处理文件
C:>ECHO C:\CPAV\BOOTSAFE>>AUTOEXEC.BAT向自动批处理文件中追加内容
C:TYPE AUTOEXEC.BAT显示该自动批处理文件
@ECHO OFF
C:\CPAV\BOOTSAFE
8. 向打印机输出打印内容或打印控制码
格式:ECHO 打印机控制码>PRN
ECHO 打印内容>PRN
下面的例子是向M-1724打印机输入打印控制码。<Alt>156是按住Alt键在小键盘键入156,类似情况依此类推:
C:>ECHO +156+42+116>PRN(输入下划线命令FS*t)
C:>ECHO +155@>PRN(输入初始化命令ESC@)
C:>ECHO.>PRN(换行)
9. 使喇叭鸣响
C:>ECHO ^G
“^G”是用Ctrl+G或Alt+007输入,输入多个^G可以产生多声鸣响。使用方法是直接将其加入批处理文件中或做成批处理文件调用。
10.执行ESC控制序列修改屏幕和键盘设置
我们知道DOS的设备驱动程序ANSI.SYS提供了一套用来修改屏幕和键盘设置的ESC控制序列。如执行下述内容的批处理程序可以把功能键F12定义为DOS命令“DIR/W”,并把屏幕颜色修改为白色字符蓝色背景。
@ECHO”←
哈哈,echo的用法不少吧,你都学会了吗?????
### Usage of the ECHO Command
The ECHO command is a sub - command of the well - known DOS batch processing commands, but there may be some functions and usages of it that you don't all know. Just take a look:
1. As a switch to control whether the command line itself is displayed when the batch processing command is executed
Format: ECHO
If you want to close the display of the “ECHO OFF” command line itself, you need to add “@” before this command line.
2. Display the current ECHO setting status
Format: ECHO
3. Output a prompt message
Format: ECHO message content
The above are the three common usages of the ECHO command, and they are also what everyone is familiar with and can use. But as a DOS command gold digger, you should also know the following tips:
4. Turn off the DOS command prompt
Typing ECHO OFF at the DOS prompt can turn off the display of the DOS prompt, leaving only the cursor on the screen. The prompt will reappear until you type ECHO ON.
5. Output a blank line, which is equivalent to entering a carriage return
Format: ECHO.
It should be noted that the “.” in the command line should be closely followed by ECHO without a space in between, otherwise the “.” will be output to the screen as a prompt message. In addition, the “.” can be replaced by any one of symbols such as,, : ; " / +.
In the following example, the carriage return output by ECHO. is redirected through the DOS pipe as the input of the TIME command, which is equivalent to giving a carriage return after the TIME command is executed. So when it is executed, the system will automatically return to the DOS prompt state after displaying the current time:
C:>ECHO.|TIME
Another application example of the ECHO command outputting a blank line is: adding ECHO. in the auto - batch file to make the originally displayed prompt screen at the bottom of the screen appear at the top of the screen.
6. Answer the question in the command
Format: ECHO answer|command file name
The above format can be used to simplify the operation of some commands that need human - computer dialogue (such as: CHKDSK / F; FORMAT Drive:; del *.*). It is to use the DOS pipe command to take the preset answer output by the ECHO command as the input of the human - computer dialogue command. The following example is equivalent to entering “Y” and a carriage return when the called command has a human - computer dialogue:
C:>ECHO Y|CHKDSK/F
C:>ECHO Y|DEL A :*.*
7. Create a new file or add content to a file
Format: ECHO file content> file name
ECHO file content>> file name
For example: C:>ECHO @ECHO OFF>AUTOEXEC.BAT to create an auto - batch file
C:>ECHO C:\CPAV\BOOTSAFE>>AUTOEXEC.BAT to append content to the auto - batch file
C:TYPE AUTOEXEC.BAT to display the auto - batch file
@ECHO OFF
C:\CPAV\BOOTSAFE
8. Output print content or print control codes to the printer
Format: ECHO printer control code> PRN
ECHO print content> PRN
The following example is to input print control codes to the M - 1724 printer. <Alt> 156 is to hold down the Alt key and type 156 on the numeric keypad. The same situation is类推:
C:>ECHO +156+42+116>PRN (input the underline command FS*t)
C:>ECHO +155@>PRN (input the initialization command ESC@)
C:>ECHO.>PRN (new line)
9. Make the speaker beep
C:>ECHO ^G
“^G” is input by Ctrl + G or Alt + 007. Entering multiple ^G can produce multiple beeps. The usage is to directly add it to the batch file or call it as a batch file.
10. Execute ESC control sequences to modify screen and keyboard settings
We know that the device driver ANSI.SYS of DOS provides a set of ESC control sequences for modifying screen and keyboard settings. For example, executing a batch program with the following content can define the function key F12 as the DOS command “DIR / W” and modify the screen color to white characters on a blue background.
@ECHO”←
|
|
2006-11-27 00:17 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
哈哈 可以很遗憾的告诉你,Wengier收集的不比你的少
Haha, it's a pity to tell you that Wengier has collected no less than you.
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-11-27 01:00 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
貌似最后两条是在 command 或者 ANSI.SYS 里才有效的,不信你试~~
It seems that the last two items are only effective in command or ANSI.SYS. Don't believe it? Try it for yourself~~
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-11-27 01:02 |
|
|
tianzizhi
高级用户
   
积分 622
发帖 214
注册 2006-9-22
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
ECHO ^G 在cmd下也有效,
@ECHO”←[0;134;”DIR/W”;13p
@ECHO”←[1;37;44m 是需要加载ansi.sys才有效,请问ansi.sys在windows下能加载吗,怎么加载?
ECHO ^G is also effective in cmd,
@ECHO”←
|
|
2006-11-27 01:15 |
|
|
NaturalJ0
银牌会员
    
积分 1181
发帖 533
注册 2006-8-14
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
看到几条新的,谢谢楼主。
Saw a few new ones, thank you the楼主.
|
|
2006-11-27 20:56 |
|
|
taoty
中级用户
   传说中的菜鸟
积分 275
发帖 112
注册 2005-4-22
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
这条命令在书上讲得非常少,开始感觉功能较弱,原来还有这么多学问啊。
This command is very little discussed in the book. At first, I felt it had weak functions, but it turns out there are so many subtleties!
|
|
2006-11-29 02:11 |
|
|
oilio
高级用户
    前进者
积分 641
发帖 303
注册 2007-1-10
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
学习了,后两条不知道怎么用。
Got it's learned. I don't know how to use the last two items.
|
|
2007-1-12 10:22 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2007-1-14 16:10 |
|
|
xiaoguiping2003
初级用户
 
积分 67
发帖 32
注册 2007-1-16
状态 离线
|
『第 9 楼』:
好资料
使用 LLM 解释/回答一下
正在学批处理,你的资料长见识啦
Learning batch processing, your materials are really eye-opening
|
|
2007-2-3 10:50 |
|
|
echo
初级用户
 
积分 148
发帖 69
注册 2006-11-23
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
echo在这呢,哇哈哈。。。
反正我机箱上的喇叭我始终没没能让它叫起来,论坛上说的办法基本试过!其他的都常用吧!
echo is here, wahaha...
Anyway, I've never been able to make the speaker on my case make a sound. I've basically tried all the methods mentioned on the forum! The others are all commonly used!
|
|
2007-2-13 23:12 |
|
|
hxmupdata
初级用户
 
积分 76
发帖 39
注册 2007-3-9
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
支持1楼的......我看过........太震撼了.....................
Supporting the first floor......I've seen it........too shocking.....................
|

狐狸喜欢狡猾。。 |
|
2007-3-12 07:58 |
|
|
xycoordinate
中级用户
  
积分 493
发帖 228
注册 2007-2-16 来自 安徽
状态 离线
|
|
2007-3-12 10:02 |
|
|
BWSkyer
中级用户
   我是DOS学者
积分 367
发帖 180
注册 2006-5-14 来自 重庆
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Originally posted by tianzizhi at 01:15:
ECHO ^G 在cmd下也有效,
@ECHO”←
这个我也在CMD试验了,太好玩了,嘿嘿~~~~都不敢相信是蜂鸣器的声音。
Originally posted by tianzizhi at 01:15:
ECHO ^G is also effective in cmd,
@ECHO”←
This I also tested in CMD, so much fun, heh heh~~~~ I can't believe it's the beep sound.
|
|
2007-3-21 11:32 |
|
|
technique
新手上路

积分 9
发帖 5
注册 2007-3-23
状态 离线
|
|
2007-3-23 14:19 |
|
|
kkof2000
初级用户
 
积分 30
发帖 15
注册 2007-4-15
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
这个命令我就懂前3种用法,后面几种看了才知道,谢谢了.
I only understand the first 3 usages of this command, and I just found out about the later ones after reading. Thanks.
|
|
2007-4-15 10:29 |
|