Purpose:Enable or disable batch file or command line echoing, display the echoing status on stdout, or display a message on stdout

 

Format:ECHO [ON | OFF | message]

message  Text to display.

 

See also the commands ECHOS, ECHOSERR, ECHOERR, ECHOX, ECHOXERR, SCREEN, SCRPUT, TEXT and VSCRPUT, and the internal variable _ECHO.

 

Usage:

 

The ECHO command has two unrelated, independently functioning purposes:

 

Command line echoing

Message display

 

Command line echoing

 

When command line echoing is enabled, each command is displayed on stdout after it is fully parsed, aliases, functions, and variables expanded, but before it is executed.

 

Echoing control

 

TCC controls command line echoing in batch files and at the interactive prompt independently.

 

Executing ECHO ON at the command prompt enables, and ECHO OFF disables echoing at the command prompt. ECHO defaults to OFF at the command line. The command-line ECHO is most useful when you are learning how to use advanced features.

 

Similarly, executing ECHO ON in a batch file enables, and ECHO OFF disables echoing of batch file commands. ECHO defaults to ON in batch files. The current ECHO state is inherited by called batch files. You can change the default setting to OFF with the SETDOS /V0 command, or the Batch Echo configuration option.

 

Regardless of the relevant echoing state, any command prefixed with the at-sign @ will not be echoed.

 

Echoing state display

 

To see the current echoing state, use the ECHO command with no parameters. This displays either the batch file or command line echo state, depending on where the ECHO command is performed. Alternately, you can examine the value of the internal variable _ECHO.

 

Message display

 

If the ECHO command has a message (the whole command tail, excluding redirection or piping, if any), and message is neither of the words ON or OFF (though it can include those words), message is fully parsed, then displayed on stdout, regardless of the applicable echoing state. Any display sent to stdout after message has been displayed will start on a new line.

 

Display rules

 

The first space after the command name is ignored.

Trailing spaces in message are ignored.

Functions and variables not enclosed between back quotes are evaluated.

To include special characters, .e.g, < | >, in message, enclose them in double quotes or back quotes (see Parameter Quoting)  or precede them with the escape character, or use the /X option of the SETDOS command.

To display % you may alternately use two % marks for each one to be displayed, e.g., %%

To display trailing spaces, either enclose them in back quotes, or append a pair of back quotes behind them, e.g., echo trailers   ``

The ASCII NUL character cannot be included in message.

If stdout is the console, after displaying message on the current line, the cursor will be moved to the beginning of the next line.

If stdout is a file, the CR LF sequence will be appended to message.

 

To display a blank line, use one of the forms below:

 

 echo ``        (two consecutive back quotes), or

 echo.                (special syntax for compatibility with CMD).

 

Examples

 

This command  will display a message:

 

echo Processing your print files...

 

The command

 

echo    This text is indented 3 spaces   ``

 

will display 3 leading and 3 trailing spaces.