WAD "tokens=*" and literal string

May 20, 2008
Syracuse, NY, USA
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
May 20, 2008
Syracuse, NY, USA
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.
May 20, 2008
Syracuse, NY, USA
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
Thread starter Title Forum Replies Date
vefatica Literal double quotes in SHORTCUT's "args" parameter? Support 6
nickles Literal tab character Support 21
P Inserting string into a variable. Support 3
M Backquoted parameters used in GoSub don't pass string as a single parameter Support 2
H Behavior change re piping a string to a Java program Support 1
C email[string] function Support 10
D Finding a string position in a larger string Support 2
MikeBaas How to...extract a string from a .json-file? Support 10
D Faster string search Support 8
D btm file command line augments comparing for string or math. Support 12
B How can TCC make an output as a part of command string Support 2
vefatica DO /L, where did my string go? Support 6
Alpengreis A leading withespace in Hash-String is not included? Support 1
T TPipe: Replacing String with Double Quotes Support 3
J WAD utf8decode string only results in ? chars Support 2
scooter_de How to? How to split the a string? Support 4
C custom string compare? Support 8
C Best way to validate a string is a YYYYMMDD Support 7
Phileosophos Documentation TPIPE /string type code confusion Support 4
vefatica Back-refs in TPIPE's /replace's replacement string? Support 2
vefatica @B64ENCODE[s,string]? Support 8
vefatica Random access to the characters in a string? Support 4
vefatica @WORD[], quoted string? Support 8
H "Here-String" redirection not working Support 6
C Can't remove leading quote from a string Support 2

Similar threads