Hardware Reference
In-Depth Information
Command
Function
copies all the files having a DOC extension in the current
directory to the printer. The command has the same effect as
COPY *.DOC LPT1: .
If is used with GOTO to provide a means of branching within a
batch file. GOTO must be followed by a label (which must begin
with :).
Example:
IF NOT EXIST SYSTEM.INI GOTO :EXIT
transfers control to the label :EXIT if the file SYSTEM.INI
cannot be found in the current directory.
IF
the pause command suspends execution of a batch file until the
user presses any key. The message:
Press any key when ready...
is displayed on the screen.
PAUSE
The REM command is used to precede lines of text which will
constitute remarks.
Example:
REM Check that the file exists before copying
REM
Creating batch files
Batch files may be created using an ASCII text editor or a word processor
(operating in ASCII mode). Alternatively, if the batch file comprises only a few
lines, the file may be created using the DOS COPY command. As an example,
let us suppose that we wish to create a batch file which will:
1
erase all of the files present on the disk placed in drive B:;
2
copy all of the files in drive A having a TXT extension to produce an
identically named set of files on the disk placed in drive B:;
3
rename all of the files having a TXT extension in drive A: to so that they have
a BAK extension.
The required operating system commands are thus:
ERASE B:\*.*
COPY A:\*.TXT B:\
RENAME A:\*.TXT A:\*.BAK
The following keystrokes may be used to create a batch file named
ARCHIVE.BAT containing the above commands (note that <ENTER> is used to
terminate each line of input):
COPY CON: ARCHIVE.BAT
ERASE B:\*.*
COPY A:\*.TXT B:\
RENAME A:\*.TXT A:\*.BAK
<CTRL-Z>
Search WWH ::




Custom Search