Windows echo command and echo command

Source: Internet
Author: User
Tags echo command

Windows echo command and echo command

The ECHO command is a sub-command of DOS batch processing commands that everyone is familiar with. However, you may not know all of its functions and usage:
1. As a switch to control whether the batchcompute command displays the command line itself during execution

Format: ECHO [ON | OFF]

To disable the display of the "echo off" command line, add "@" before the command line.

2. display the current ECHO setting status

Format: ECHO

3. Output prompt information

Format: ECHO content

The preceding three methods are common for ECHO commands. They are also common and useful. However, you should also be familiar with the following techniques as the doscommand gold taozer:

4. Close the doscommand prompt

In the DOS prompt state, type echo off to close the display of the DOS prompt so that only the cursor is left ON the screen until echo on is typed.

5. Empty output line, which is equivalent to entering a carriage return

Format: ECHO.

It is worth noting that "." In the command line must be followed by no space in the middle of the ECHO, otherwise "." will be output to the screen as a prompt. In addition, "." can be replaced by any symbol, such as:; "/[/] +.

In the following example, the ECHO. Output carriage return is switched to the input as the TIME command through the DOS pipeline, which is equivalent to a carriage return after the TIME command is executed. Therefore, the system will automatically return to the DOS prompt status after the current time is displayed during execution:

C:> ECHO. | TIME

The ECHO command output is another example of an empty line application: Add ECHO. To the automatic batch processing file so that the prompt screen originally displayed at the bottom of the screen appears at the top of the screen.

6. answer questions in the command

Format: ECHO Reply | command file name

The preceding FORMAT can be used to simplify commands that require human-machine interaction (for example, CHKDSK/F; FORMAT Drive:; del *. *). It uses the DOS pipeline command to use the preset reply language output by the ECHO command as the input of the man-machine conversation command. The following example is equivalent to entering "Y" and press Enter when a man-machine conversation occurs in the called command:

C:> echo y | CHKDSK/F

C:> echo y | del :*.*

7. Create a new file or add File Content

Format: ECHO file content> file name

ECHO file content> file name

For example, C:> ECHO @ echo off> AUTOEXEC. BAT creates an automatic batch file.

C:> echo c:/CPAV/BOOTSAFE> AUTOEXEC. BAT Append content to the automatic batch file

C: type autoexec. BAT: displays the automatic batch processing file

@ ECHO OFF

C:/CPAV/BOOTSAFE

8. Print content or control code to the printer

Format: ECHO printer control code> PRN

ECHO print content> PRN

The following example is to input a print control code to the M-1724 printer. <Alt> 156 press and hold the Alt key to type 156 on the keypad. in similar cases, follow these steps:

C:> ECHO + 156 + 42 + 116> PRN (enter the underline command FS * t)

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

C:> ECHO.> PRN (line feed)

9. Sound the horn

C:> ECHO ^ G

"^ G" is input using Ctrl + G or Alt + 007. Multiple ^ G inputs can generate multiple audible sounds. You can directly add it to a batch file or call it as a batch file.

10. Execute the ESC control sequence to modify screen and keyboard settings

We know that the DOS Device Driver ANSI. SYS provides a set of ESC control sequences used to modify screen and keyboard settings. If you execute the following batch processing program, you can define the function key F12 as the DOS command "DIR/W" and change the screen color to the blue background of the white character.

@ ECHO "values [0; 134;" DIR/W "; 13 p

@ ECHO "response [1; 37; 44 m

(Note: In the batch processing file, the "marker" character is entered by pressing 27 on the Alt keypad in the editing status)

The doscommand is the first thing people need to learn from computers. It is too easy for many people to be familiar with it. Otherwise, there is a wealth of content in these commands, it remains to be further understood and developed. If you are a kind of person, you will surely find new bright spots from these self-known commands, so that you can get real money.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.