You misunderstood the options.
tokens=1 means that you only need the first token on each line. You need all the tokens on the line.eol=, means you want to interpret the comma as the beginning of the end of line comment. You want to use delims=, instead, to indicate that the comma is a delimiter (instead of the default value for spaces).
FOR / F is primarily intended to work in lines in a file. You do not do this. You work on one line, so Rubens answer is closer to what you want:
@ECHO OFF SET test=1,2,3,4 FOR /D %%F IN (%test%) DO ( ECHO . ECHO %%F )
However, theoretically you should be able to say something like:
FOR /F "usebackq delims=, tokens=1-4" %%f IN ('1^,2^,3^,4') DO ( ECHO . ECHO %%f ECHO . ECHO %%g ECHO . ECHO %%h ECHO . ECHO %%i )
This works as well, but probably does not scale the way you want. Note that you need to escape the comma in the string with the ^ character, and you must specify the desired markers, and then use the subsequent variables% g,% h and% i to get them.
i_am_jorf
source share