Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the ECHO command in DOS

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Xiaobian to share with you how to use the ECHO command in DOS, I believe most people do not know how to use it, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

ECHO command is a subcommand of DOS batch command that everyone is familiar with, but some of its functions and usage may not be all known to you, do not believe you see:

1. As a switch that controls whether batch commands display the command line itself when executed

Format: ECHO [ON]| OFF]

If you want to turn off the ECHO OFF command line itself, you need to prefix the command line with an @.

2. Display current ECHO setting status

Format: ECHO

3. outputting prompt information

Format: ECHO information content

The above are the three common uses of the ECHO command, which are familiar to everyone and will be used, but as a DOS command gold digger you should also know the following tips:

4. Close DOS command prompt

Typing ECHO OFF at the DOS prompt can turn off the DOS prompt display leaving only the cursor on the screen until ECHO ON is typed and the prompt does not reappear.

5. Output blank line, which is equivalent to entering a carriage return

Format: ECHO.

It is worth noting that the command line ". "Immediately after ECHO, there must be no space in the middle, otherwise". "will be output to the screen as a prompt message. Also "... "may be replaced by any symbol such as,:;"/[\]+.

In the example below, the carriage return output from ECHO. is diverted via the DOS pipeline as input to the TIME command, which is equivalent to giving a carriage return after the TIME command is executed. So when executed, the system will automatically return to the DOS prompt state after displaying the current time:

C:>ECHO.| TIME

Another example of an ECHO command with blank lines is to add ECHO. to an autobatch file so that a prompt that would otherwise appear at the bottom of the screen appears at the top.

6. Answer the questions in the command

Format: ECHO Response| command file name

The above format can be used to simplify some commands that require human-computer interaction (e.g. CHKDSK/F;FORMAT Drive:;del *.*) It is through DOS pipeline command ECHO command output preset reply language as man-machine dialogue command input. The following example is equivalent to typing "Y" when the command invoked appears in the man-machine dialogue:

C:>ECHO Y|CHKDSK/F

C:>ECHO Y|DEL A :*.*

7. Create new documents or add document content

Format: ECHO File Content> File Name

ECHO File Content>> File Name

For example: C:>ECHO @ECHO OFF>AUTOEXEC.BAT Create automatic batch files

C:>ECHO C:\CPAV\BOOTSAFE>>AUTOEXEC.BAT appends content to an automatic batch file

C:TYPE AUTOEXEC.BAT Displays the automatic batch file

@ECHO OFF

C:\CPAV\BOOTSAFE

8. Output print content or print control code to printer

Format: ECHO printer control code>PRN

ECHO Print Content>PRN

The following example is to enter the print control code into the M-1724 printer. 156 is typed on the keypad while holding down the Alt key, and so on:

C:>ECHO +156+42+116>PRN (Enter underlined command FS*t)

C:>ECHO +155@>PRN (Enter initialization command ESC@)

C:>ECHO.>PRN (newline)

9. honk a horn

C:>ECHO ^G

"^G" is typed with Ctrl+G or Alt+007, and multiple ^G's produce multiple chimes. The method of use is to add it directly to the batch file or make it a batch file call.

10. Perform ESC control sequences to modify screen and keyboard settings

We know that the DOS device driver ANSI.SYS provides a set of ESC control sequences for modifying screen and keyboard settings. For example, a batch program executing the following 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"←[0;134;"DIR/W";13p

@ECHO"←[1;37;44m

(Note: The input method for the "←" character in the batch file is to press 27 on the keypad in Alt while editing)

DOS command is the first contact with the computer to learn, for many people is too familiar with too simple, in fact, in these commands contain rich content, still waiting for us to further understand to develop, if you are a dedicated person will certainly be familiar with these commands from the discovery of new flash points, Amoy gold.

The above is "DOS ECHO command how to use" all the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report