Using FOR to perform an operation on a file collection

The FOR command allows one to specify a file wildcard (*.txt) and what operation to perform on each file that matches the wildcard (type).

When using the FOR loop directly from the command prompt:

FOR %f IN (*.txt) DO type %f

When using FOR inside af batch file:

FOR %%f IN (*.txt) DO type %%f

Related Create your own file find utility using FOR

More Info MS KB68268
More Info MS KB75634
More Info MS KB134572