1.

Solve : display content of a list within a variable?

Answer»

Hi,

I have a variable LIST=ELEM1;ELEM2;ELEM3
which command should I call to have for results
ELEM1
ELEM2
ELEM3


if I do the following command line; I do have only the first element of the list (while the other are probably in %J and so on)
> for /F "delims=;" %i in ("%LIST%") do echo %i
ELEM1


note that I do construct the LIST, so I can CHANGE the delimiters or the FORMAT if required.

thanks
found by myself

I change my list format to have space as delimiters LIST=ELEM1 ELEM2 ELEM3

SET AUTO_VARIABLE_LIST=%LIST%
:FOR_LOOP
for /f "tokens=1* " %%i in ("%AUTO_VARIABLE_LIST%") do (
call echo %%i
set AUTO_VARIABLE_LIST=%%j
)
if "%AUTO_VARIABLE_LIST%"=="" GOTO :END_LOOP else (
GOTO :FOR_LOOP
)
:END_LOOP





Discussion

No Comment Found