DOS Basics 2-11
Batch File Command Line Parameters
A batch file may use parameters placed on the command line. Insert
these parameters as arguments for commands or instructions within the
batch file. For example, the following batch file, named ARCHIVE,
accepts a command line parameter:
PRINT %1
COPY %1 \ARCHIVE\*.*
DEL %1
Execute the ARCHIVE batch file by entering
ARCHIVE THISFILE.DAT
The %1 parameter takes on the name THISFILE.DAT, and the batch file
executes the following to make a copy of THISFILE.DAT in the ARCHIVE
subdirectory:
PRINT THISFILE.DAT
COPY THISFILE.DAT \ARCHIVE\*.*
DEL THISFILE.DAT
Note: %1 represents the first parameter in a batch file command. If a
command has multiple parameters, they are represented by %2,
%3, and so on.
Batch File Commands
In addition to the standard ROM-DOS commands, there are other
commands specifically for batch files. Refer to CALL, CHOICE, ECHO,
FOR, GOTO, IF, PAUSE, REM, and SHIFT later in this manual for more
information on these commands.