Ref: 03050002
Title: Automatically Turning On Echo Within Batch Files
Date: 2/6/90

Copyright 3Com Corporation, 1991.  All rights reserved.

It is often useful to have batch files echo to the display screen
the commands they are executing.  One way to do this is to edit the
batch file and change the 'echo off' statement at the beginning of
the file to 'echo on.'

However, the 'echo on' works only for the batch file being executed
(and not for any child batch files it might call in turn), and, by
repeatedly editing it, one might accidentally introduce a bug into the
batch file.

To prevent such problems, and to set up your batch files so echoing
can be turned on with a command-line command to ALL levels of nesting
of called batch files, simply place the following lines at the
beginning of your batch files:

echo off
::: set echo=on
if "%echo%" == "on" echo on

(The ::: at the start of the second line serves to comment it out.)

Then, whenever you want to see the commands of a batch file (and any
other batch files it may call in turn) echoed as they execute, type
the following command at the DOS (or OS/2) command line:

set echo=on

Afterwards, to execute the batch file, type its name.  It, and any
subsequent batch files you run, will echo their commands to the screen.

To turn off automatic echoing at any time in the future, simply type:

set echo=

