title: How to use array in batch file?
body: <p>I'm trying to rename the NIC names on my PC. It has A LOT of NICs (they are virtual). I can get their names like so</p>
  
  <pre><code>for /f "tokens=2 delems==" %%A in ('wmic nic where "Description like 'foo'" get netconnection id /value') do (
   echo %%A
  )
  </code></pre>
  
  <p>I'd like to use netsh inside that loop to rename them. Unfortunately, the target names aren't simple incrementing numbers. So I did</p>
  
  <pre><code>set names[0]=name1
  set names[1]=name two
  set names[2]=name test
  set local ENABLEDELAYEDEXPANSION
  set /a idx=0
  for /f "tokens=2 delems==" %%A in ('wmic nic where "Description like 'foo'" get netconnectionid /value') do (
   echo names[!idx!]
   set /a idx=!idx!+1
  )
  </code></pre>
  
  <p>This outputs</p>
  
  <pre><code>names[0]
  names[1]
  names[2]
  </code></pre>
  
  <p>But if I try </p>
  
  <pre><code>set names[0]=name1
  set names[1]=name two
  set names[2]=name test
  set local ENABLEDELAYEDEXPANSION
  set /a idx=0
  for /f "tokens=2 delems==" %%A in ('wmic nic where "Description like 'foo'" get netconnectionid /value') do (
   echo %names[!idx!]%
   set /a idx=!idx!+1
  )
  </code></pre>
  
  <p>I just get garbage output. Is there some way I can evaluate the generated string in the previous example as a variable? Then I could pass that to netsh to do the renaming.</p>