for /f and wild cards

#1
The Help for FOR gives an example of "for /f "tokens=1,2,3" %d in (*.txt) ...". The wild card doesn't seem to work:

Code:
C:\Junk>type foo.btm
for /f "tokens=1,2,3" %d in (*.txt) do echo %d

C:\Junk>type foo.txt
a b c
d e f

C:\Junk>foo.btm
ECHO is OFF

C:\Junk>ver /r

TCC  12.11.70   Windows Vista [Version 6.0.6002]
TCC Build 70   Windows Vista Build 6002  Service Pack 2
Registered to David Marcus - 1 System License
 

rconn

Administrator
Staff member
May 14, 2008
10,551
97
#2
The Help for FOR gives an example of "for /f "tokens=1,2,3" %d in (*.txt) ...". The wild card doesn't seem to work:
WAD; the help is wrong.

This was originally intended to be a feature (which CMD doesn't support), but we ran into problems with CMD batch files using wildcards that didn't expect them to be expanded.

Fortunately, it's all doable (a LOT easier) with DO.