Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Echo Batch Files
02-05-2010, 06:11 AM
Post: #1
Echo Batch Files
Loads of people use some batch commands but they didn't ever use echo function for writing on the screen. Here is a short explanation how to use echo.
Echo basically turns the command-echoing feature on or off, or displays a message. Used without parameters, echo displays the current echo setting.
Syntax :
Code:
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:
Code:
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:
Code:
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 :
Code:
@echo off
You can use the if and echo commands on the same command line. For example :
Code:
if exist *.rpt echo The report has arrived.
But that is combining with if statement. That is everything about this small echo batch tut. Hope you like it !

"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: