I have this list in batch:
set list=12,34,56
echo %list%
How can I get the list to print only 34?
I have this list in batch:
set list=12,34,56
echo %list%
How can I get the list to print only 34?
To print the second number 34
:
for /f "tokens=2 delims=," %%a in ("%list%") do @echo %%a
To print all 3 numbers 12 34 56
:
for /f "tokens=1-3 delims=," %%a in ("%list%") do @echo %%a %%b %%c
The double percents in %%a
are required in a batch file. At the command prompt, use just %a
.