次の方法で共有


Echo

Turns the command-echoing feature on or off, or displays a message. Used without parameters, echo displays the current echo setting.

Syntax

echo [{on|off}] [message]

Parameters

{ on | off } : Specifies whether to turn the command-echoing feature on or off.

message   : Specifies text you want to display on the screen.

/?   : Displays help at the command prompt.

Remarks

  • The echo message command is useful when echo is turned off. To display a message that is several lines long without displaying other commands, you can include several echo message commands after the echo off command in your batch program.

  • If you use echo off, the command prompt does not appear on your screen. To display the command prompt, type echo on.

  • To prevent echoing of a line, insert an at sign (@) in front of a command in a batch program.

  • To echo a blank line on the screen, type:

    echo.

  • To display a pipe (|) or redirection character (< or >) when you are using echo, use a caret character immediately before the pipe or redirection character (for example, ^>, ^<, or ^| ). If you need to use the caret character (^), type two (^^).

Examples

The following example is a batch program that includes a three-line message preceded by and then followed by a blank line:

echo off
echo. 
echo This batch program 
echo formats and checks 
echo new disks 
echo. 

If you want to turn echo off and you do not want to echo the echo command, type an at sign (@) before the command as follows:

@echo off 

You can use the if and echo commands on the same command line. For example:

if exist *.rpt echo The report has arrived.

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

Pause

Command-line reference A-Z