![]() |
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-27 02:23 |
47,812 topics / 349,912 posts / today 2 new / 48,264 members |
| DOS学习入门 & 精彩文章 (教学室) » How much do you know about the usage of the echo command? |
| Printable Version 8,725 / 25 |
| Floor1 tianzizhi | Posted 2006-11-27 00:17 |
| 高级用户 Posts 214 Credits 623 | |
|
### 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”← |
|
| Floor2 electronixtar | Posted 2006-11-27 01:00 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Haha, it's a pity to tell you that Wengier has collected no less than you.
|
|
| Floor3 electronixtar | Posted 2006-11-27 01:02 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
It seems that the last two items are only effective in command or ANSI.SYS. Don't believe it? Try it for yourself~~
|
|
| Floor4 tianzizhi | Posted 2006-11-27 01:15 |
| 高级用户 Posts 214 Credits 623 | |
|
ECHO ^G is also effective in cmd,
@ECHO”←[0;134;”DIR/W”;13p @ECHO”←[1;37;44m requires loading ansi.sys to be effective. Does ansi.sys work in Windows, and how to load it? |
|
| Floor5 NaturalJ0 | Posted 2006-11-27 20:56 |
| 银牌会员 Posts 533 Credits 1,181 | |
|
Saw a few new ones, thank you the楼主.
|
|
| Floor6 taoty | Posted 2006-11-29 02:11 |
| 中级用户 Posts 112 Credits 275 | |
|
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!
|
|
| Floor7 oilio | Posted 2007-01-12 10:22 |
| 高级用户 Posts 303 Credits 641 | |
|
Got it's learned. I don't know how to use the last two items.
|
|
| Floor8 DOSforever | Posted 2007-01-14 16:10 |
| 金牌会员 Posts 2,239 Credits 4,639 | |
|
Correct it: use the escape function of ANSI.SYS without the " symbol
|
|
| Floor9 xiaoguiping2003 | Posted 2007-02-03 10:50 |
| 初级用户 Posts 32 Credits 67 | |
|
Learning batch processing, your materials are really eye-opening
|
|
| Floor10 echo | Posted 2007-02-13 23:12 |
| 初级用户 Posts 69 Credits 148 | |
|
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! |
|
| Floor11 hxmupdata | Posted 2007-03-12 07:58 |
| 初级用户 Posts 39 Credits 76 | |
|
Supporting the first floor......I've seen it........too shocking.....................
|
|
| Floor12 xycoordinate | Posted 2007-03-12 10:02 |
| 中级用户 Posts 228 Credits 493 From 安徽 | |
| Floor13 BWSkyer | Posted 2007-03-21 11:32 |
| 中级用户 Posts 180 Credits 367 From 重庆 | |
Originally posted by tianzizhi at 01:15: |
|
| Floor14 technique | Posted 2007-03-23 14:19 |
| 新手上路 Posts 5 Credits 9 | |
|
Good stuff
|
|
| Floor15 kkof2000 | Posted 2007-04-15 10:29 |
| 初级用户 Posts 15 Credits 30 | |
|
I only understand the first 3 usages of this command, and I just found out about the later ones after reading. Thanks.
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |