• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

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
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.
Top Bottom