You have seen one facet of ECHO already: it can send a messageto the screen. More
importantly, it can help clear the clutter on the screen when a batch file executes. Normally, the
batch file commands would show on the screen as if you were typing them. This can get distracting.
If you want to suppress the command echoing type:
ECHO OFF
To restart echoing, type: ECHO ON
When ECHO is off no part of the actual DOS commands in the batch file will show on the
screen. To display a message put it after the ECHO command:
ECHO Message
As you will see, the REMark command also displays messages; butNOT if ECHO is off!
Use ECHO if you want the message to show no mater what.
REMark
REMark can be used to send messages to the screen or simply to document some part of
your batch file's operation.
Use them extensively in long batch files. The computer operator (it won't always be you)
wants to know what is happening and, over time, you might forget whata complicated set of
commands really does.
The format is:
REMMessage
REMarks can be up to 123 characters long, although you usually won't want to go over the
screen width so you can control the display.
An undocumented, variation of this command is the period. In DOS 2.x, if a line in a batch
file starts with one or more periods (.) it is treated as a remark. It is dangerous to use this however
since in DOS 3.x and later that same line would be treated as the path to a command!
PAUSE
The last "simple" command is PAUSE. Its basic function is to stop the execution of the
batch file until you press a key. This can allow you to perform anecessary task; like perhaps
changing a disk or verifying that a particular disk configuration is in place in order to avoid errors
as the remaining parts of the batch file are executed.
In early DOS versions PAUSE would optionally display a message. It does not now. In
order to display a message you have to couple PAUSE with the ECHO command. The format in use
now would require:
ECHO Message
PAUSE
The message will show, followed by the DOS message:
Strike a key when ready... (in early DOS versions)
Press any key to continue... (in later DOS versions)
importantly, it can help clear the clutter on the screen when a batch file executes. Normally, the
batch file commands would show on the screen as if you were typing them. This can get distracting.
If you want to suppress the command echoing type:
ECHO OFF
To restart echoing, type: ECHO ON
When ECHO is off no part of the actual DOS commands in the batch file will show on the
screen. To display a message put it after the ECHO command:
ECHO Message
As you will see, the REMark command also displays messages; butNOT if ECHO is off!
Use ECHO if you want the message to show no mater what.
REMark
REMark can be used to send messages to the screen or simply to document some part of
your batch file's operation.
Use them extensively in long batch files. The computer operator (it won't always be you)
wants to know what is happening and, over time, you might forget whata complicated set of
commands really does.
The format is:
REMMessage
REMarks can be up to 123 characters long, although you usually won't want to go over the
screen width so you can control the display.
An undocumented, variation of this command is the period. In DOS 2.x, if a line in a batch
file starts with one or more periods (.) it is treated as a remark. It is dangerous to use this however
since in DOS 3.x and later that same line would be treated as the path to a command!
PAUSE
The last "simple" command is PAUSE. Its basic function is to stop the execution of the
batch file until you press a key. This can allow you to perform anecessary task; like perhaps
changing a disk or verifying that a particular disk configuration is in place in order to avoid errors
as the remaining parts of the batch file are executed.
In early DOS versions PAUSE would optionally display a message. It does not now. In
order to display a message you have to couple PAUSE with the ECHO command. The format in use
now would require:
ECHO Message
PAUSE
The message will show, followed by the DOS message:
Strike a key when ready... (in early DOS versions)
Press any key to continue... (in later DOS versions)