title: Why the % variable is not working as ! variable in my batch file?
body: <p>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.</p>
  
  <p>Here is what I am trying to do:</p>
  
  <pre><code>     @echo off
       setlocal enabledelayedexpansion
       SET var[0]=a
       SET var[1]=b
       SET var[2]=c
       SET var[3]=d
       for %%a in (0,1,2,3) do (
       SET name=%var[%%a]%
       ECHO %name%
       )
  </code></pre>
  
  <p>but the result is showing the last value of array which is 'd'. I don't want to use <code>ECHO !name!</code>. And expecting the output as below with <code>%</code></p>
  
  <pre><code> a
   b
   c
   d
  </code></pre>