![](http://pdfasset.owneriq.net/f/7c/f7c186ed-51d4-4e09-8fea-4a26d0afd9bb/f7c186ed-51d4-4e09-8fea-4a26d0afd9bb-bg4e.png)
4-36 ROM-DOS Internal Commands
FOR
Batch File Command
The FOR command allows repeated execution of a ROM-DOS command
applied to a set of files.
Syntax
FOR %%variable IN (set) DO command %%variable
Remarks
During execution, this command attaches the
variable
as an identifier to
each file in the
set
of files described; it then applies the
command
to
each of these identified files. The
set
may be an exact list of complete
file names or a global file specification using wildcard characters.
The FOR subcommand can be used directly on the command line and
within a batch file. To use on the command line, substitute a single
percent (%) symbol for the double percent signs (%%).
Examples
FOR %%N IN (Q1.TXT Q2.TXT) DO PRINT %%N
Prints only the files Q1.TXT and Q2.TXT.
FOR %%N IN (*.TXT) DO PRINT %%N
Prints all files in the current default directory with a .TXT extension.