Tandy 1000 MS-DOS Reference Manual page 111

Hide thumbs Also See for 1000 MS-DOS:
Table of Contents

Advertisement

r
!
FOR
Chapter 6 / Command Reference
Internal
!
I
I'
i
n
,
I~
I
.
I'
I
'
~
I
'
I
I
r
I
!
I '
I
FOR %C IN
(set)
DO
command
(regular MS-DOS command)
FOR %%C IN
(set)
DO
command
(batch file command)
Executes the specified command once for each item in set.
Parameters
set is a list of items. Each item in the list is separated with a
space or comma. You can include wildcards in the list. Files,
directories, and disk drives are only a few of the items you can
list.
%C
is anyone-character variable except 0-9 that MS-DOS uses
to represent the items in set. DO tells MS-DOS to do the
command.
%%C
is the same as
%C,
except the second percent sign is
required when the command is in a batch file.
command is the command you are executing.
Notes and Suggestions
• Append
%C
(or
%%C
for a batch file) to the command to exe-
cute it sequentially for each item in set, substituting that
item into the command. For example:
for
roB
in (*.dat *.dta) do dir
roB
This first displays a directory of all .dat files, then displays a
directory of all .dta files. However, if you omit the %g at the
end of command, FOR executes the command one time for
each item in set, but does not substitute each item into the
command.
for
roB
in (*.dat *.dta) do dir
This displays a directory of the entire disk twice (once for
each item in set).
• Use FOR whenever you want to execute a command for several
items, so you do not repeat the command unnecessarily.
97

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents