The script above will echo out the list 'LIST_ITEMS' but will only echo out the first variable 'OTHER_ITEMS_0'. I want to access all the variables that start with 'OTHER_ITEMS_' following the access of the array 'LIST_ITEMS'. I've tried ever combination of %, !, ", ... options I can think of and also I don't mind if all the variables of OTHER_ITEMS_ go into a list but again I want to access both list/arrays/variables in sequential order as list 'LIST_ITEMS' is accessed.
@if "%BATCH_DEBUG%"=="" echo off SetLocal EnableDelayedExpansion SET LIST_ITEMS=(ITEM1 ITEM2 ITEm3 ITEM4) SET OTHER_ITEMS_0="TEST1" SET OTHER_ITEMS_1="TEST2" SET OTHER_ITEMS_2="TEST3" SET OTHER_ITEMS_3="TEST4" SET /A COUNT=0 for %%x in %LIST_ITEMS% do ( ECHO. REM Line below will only echo out only "TEST1" ECHO !OTHER_ITEMS_%COUNT%! REM Line below will echo out the full ist 'LIST_ITEMS' REM ECHO %%x SET /A COUNT+=1 ) :End POPD ECHO. & ECHO Press any key to close this window... PAUSE >NUL ENDLOCAL EXIT /B 1
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
15 Experts available now in Live!