

txt files are found when the batch file is run, the following message displays: This directory contains no text files. txt file name extension, and displays a message indicating the results of the search: offĮcho This directory contains no text files.Įcho This directory contains the following text files: The following batch file searches the current directory for files with the. rpt file name extension, and to echo a message if such a file is found, type: if exist *.rpt echo The report has arrived. For example, to search the current directory for any file with the. You can use the echo command as part of an if statement. To prevent all commands in a batch file (including the echo off command) from displaying on the screen, on the first line of the batch file type: off To display the command prompt again, type echo on. When echo is turned off, the command prompt doesn't appear in the Command Prompt window. To echo a blank line on the screen, type: echo. To display the current echo setting, type: echo To display a caret, type two carets in succession ( ^^). To display a pipe ( |) or redirection character ( ) when you are using echo, use a caret ( ^) immediately before the pipe or redirection character. To prevent echoing all commands in a batch file, include the echo off command at the beginning of the file. To prevent echoing a particular command in a batch file, insert an sign in front of the command. If used in a batch file, echo on and echo off don't affect the setting at the command prompt. To display the command prompt, type echo on. To display a message that is several lines long without displaying any commands, you can include several echo commands after the echo off command in your batch program.Īfter echo is turned off, the command prompt doesn't appear in the Command Prompt window. The echo command is particularly useful when echo is turned off. Specifies the text to display on the screen. Turns on or off the command echoing feature. If used without parameters, echo displays the current echo setting. Displays messages or turns on or off the command echoing feature.
