I was trying to use tokens in a for loop to separate a CSV file in my batch file. Here's the code snippet:
for /f "tokens=1-31* delims=," %%a in ("!revamped!") do (
echo %%a
echo %%b
...
echo %%y
echo %%z
rem what parameter should I use next?
)
After using %%a all the way to %%z, I have no idea which parameter should I use next.
Question: What is the order of using parameters after using all %%a to %%z in a for loop?
for)*is a token (in this case %%a) after which usage no other tokens can be used. Afterzcomes{- check the ascii table. Though probably will be better to start with%Aas upper case letters have smaller numbers in the ascii table. Mind that you are limited to31tokens. For more you'll need nested loop.forto use more than 31 tokens. (provided by dbenham)tokens=*option specify all the tokens returned in a single token-letter, so thedelims=part don't matters in this case. Try:for /f "tokens=* delims=," %%a in ("One,Two,Three") do echo a=%%a, b=%%b; the output is:a=One,Two,Three, b=%b. To use several tokens you always must specify how many (maximum 31+1). For example:for /f "tokens=1-31* delims=," %%? in ...