In DOS 5.0, you cannot use the command inside the IN (...) part of the instruction. However, you can do the following:
FOR -F %%A IN (*.txt) DO command
which will execute command for each file with the txt extension. In other words, the dir command is implicit.
I received this information from Jeff Prosise DOS 5. At that time, indispensable, now quite dusty. I never knew that I would ever use it ,-)
EDIT: It turned out that indirection (see history) is not required. The above expression is all you need. Ie, the following works and prints each file:
FOR -F %%A IN (*.txt) DO TYPE %%A
Abel
source share