Name
for
Synopsis
Use this command to repeat a specified command any number of times.
You specify an arbitrary variable name and a set of values to be
iterated through. For each value in the set, the command is repeated.
The options used by for
are the following:
for [/d] %variable
in (set
) docommand
[arguments
] for /r [path
] %variable
in (set
) docommand
[arguments
] for /l %variable
in (start,step,end) docommand
[arguments
]
Option |
Description |
---|---|
|
The command to execute or the program filename to run. |
% |
A one-letter variable name that is assigned, one-by-one, to the elements listed in set. When used in a batch file, the variable name must be preceded by two percent signs. |
|
The sequence of elements through which the for command cycles.
Elements are separated with spaces, and can be files, strings, or
numbers. Use the |
|
Instructs for to match against directory names instead of filenames
if set contains wildcards. Can't be used with the
|
|
Specifies that set takes the form of start,step,end, allowing you to specify a range of numbers and an increment instead of having to list each element. |
|
Recursively executes command for each directory and subdirectory in
path. If path is omitted, the current directory is used. Without
|
Get Windows XP Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.