Batch Files

Batch Files

Sections: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Index | Next >

ECHO Command (Internal)

Learning objective: (2) Explain the use of the ECHO command in batch files


Click on image to enlarge.

The ECHO command controls the flow of information to the screen for the user's benefit. The "@" at symbol added to a command suspends the entering and execution message of a single DOS command. The ECHO command itself has four uses. The ECHO ON is the default setting in DOS. It displays the execution of all lines of the batch file to the screen. ECHO OFF suspends the entering and execution message of all DOS commands below it. ECHO text sends the text message to the screen. And ECHO. period creates a blank line on the screen.

ECHO text

ECHO text displays text to the console. Note the space between ECHO and the text.

ECHO ON | off

ECHO ON | off enables the use of the ECHO command. ECHO ON allows developers to see the commands being executed on the command line during execution. Note the space between ECHO and the text. ECHO ON is the default setting.

ECHO.

ECHO. will create a blank line to the console. Note there is no space between ECHO and the period.

@

@ suspends the echoing to the console for a single line in the batch file.

@ECHO OFF

@ECHO OFF turns off echoing for the remainder of the batch file including this line.

Key terms: @, ECHO, console

Resources:
To maximize your learning, please visit these Web sites and review their content to help reinforce the concepts presented in this section.

Quick links:
ECHO @ ss64.com
ECHO @ Wikipedia

Embedded Resources

Notes on navigation: Click inside the frame to navigate the embedded Web page. - Click outside the frame to navigate this page to scroll up/down between the embedded Web pages. - Click on the frame title to open that page in a new tab in most browsers. - Click on the the "Reload page" link to reload the original page for that frame.

ECHO @ ss64.com | Reload page | If frame is empty, click on the link to view the page in a new tab or window

ECHO @ Wikipedia | Reload page | If frame is empty, click on the link to view the page in a new tab or window

Sections: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Index | Next >