DOS Basics 2-9
Output Redirection
The syntax for redirecting output to a file is
> filename
When this is added to the end of the command line, standard output is
temporarily directed to the file named
file name
. If the named file already
exists, its contents are replaced with the ROM-DOS function’s output.
Otherwise, a new file is created to hold the output. Output can also be
redirected to a device such as PRN (the printer).
To append output to the receiving file, rather than replace its contents,
use >>.
>> filename
This adds the ROM-DOS function’s output to the existing contents of the
named file. If the named file does not exist, ROM-DOS creates the file.
For example, if you want to save a list of the current directory contents to
a file, you can redirect the DIR command’s output to a file by entering:
DIR > MYDIR.TXT
where MYDIR.TXT is the name of the file you want to contain the
directory listing.
Using Batch Files
A batch file is a standard text file containing a list of commands that can
be submitted to ROM-DOS for automatic sequential execution. Using
batch files helps you avoid unnecessary retyping of command sequences
that are commonly repeated, complex, or difficult to remember.
The ROM-DOS command processor provides full batch file processing,
compatible with standard DOS version 6.22, DOS version 7.1, and
Windows 98 DOS box long file name support. Batch files can include
internal DOS commands, external DOS commands, batch file commands,
names of other executable files or programs, or even the names of other
batch files.