By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WAD "tokens=*" and literal string

FOR with "tokens=*" seems to work when parsing lines from a file
v:\> echo a b^nc d > abcd.txt
v:\> for /f "tokens=*" %line in ( abcd.txt ) do echo %line
a b
c d
and when parsing command output
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
But "tokens=*" doesn't work with a literal string.
v:\> for /f "tokens=*" %line in ( "a b c" ) do echo %line
Where did you get the imaginary "tokens=*" syntax? (Not from the help file!)
It would be in keeping with CMD-compatibility, and it works in the two other forms of FOR /F. So I presumed ... My mistake if it's not supposed to work in the case of a literal string.
That's not currently supported. You can add it to the suggestion list if you need it.
I don't need it. It came from another thread where the OP's goal would have been achieved if it worked. The workaround is to use "delims=" (then you get the whole string in one variable ... and can subsequently use "~t" on it). Actually it seems like an unlikely thing to *need* unless there's some important BATfile from MS that does it and one demands utter compatibility with CMD.

Similar threads