I am using array in my for loop and trying to assign the value to a variable when each time loop process the array value. but when I am assigning the value to my variable, then the result is not as expected.
Here is what I am trying to do:
@echo off setlocal enabledelayedexpansion SET var=a SET var=b SET var=c SET var=d for %%a in (0,1,2,3) do ( SET name=%var[%%a]% ECHO %name% )
but the result is showing the last value of array which is 'd'. I don't want to use
ECHO !name!. And expecting the output as below with
a b c d