- May
- 13,823
- 211
FOR with "tokens=*" seems to work when parsing lines from a file
and when parsing command output
But "tokens=*" doesn't work with a literal string.
Code:
v:\> echo a b^nc d > abcd.txt
v:\> for /f "tokens=*" %line in ( abcd.txt ) do echo %line
a b
c d
Code:
v:\> for /f "tokens=*" %line in ( 'dir *b.txt' ) do echo %line
Volume in drive V is DATA Serial number is c007:d3e4
Directory of V:\*b.txt
2013-06-28 11:23 9 a b.txt
9 bytes in 1 file and 0 dirs 4,096 bytes allocated
6,250,307,584 bytes free
Code:
v:\> for /f "tokens=*" %line in ( "a b c" ) do echo %line
ECHO is OFF