oem.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
FOR
Notes  Examples
────────────────────────────────────────────────────────────────────────────
 
                                    FOR
 
Runs a specified command for each file in a set of files. You can use this
command in batch programs or at the command prompt.
 
Syntax
 
To use FOR in a batch program, use the following syntax:
 
    FOR %%variable IN (set) DO command [command-parameters]
 
To use FOR from the command prompt, use the following syntax:
 
    FOR %variable IN (set) DO command [command-parameters]
 
Parameters
 
%%variable or %variable
    Represents a replaceable variable. The FOR command replaces %%variable
    (or %variable) with each text string in the specified set until the
    command (specified in the command parameter) processes all the files.
    Use %%variable to carry out the FOR command within a batch program. Use
    %variable to carry out FOR from the command prompt.
 
(set)
    Specifies one or more files or text strings that you want to process
    with the specified command. The parentheses are required.
 
command
    Specifies the command that you want to carry out on each file included
    in the specified set.
 
command-parameters
    Specifies any parameters or switches that you want to use with the
    specified command (if the specified command uses any parameters or
    switches).
 
                                      ♦