title: Batch file FOR loop using incrementing variable
body: <p>I've created a batch file that is supposed to assign three attached interface descriptions as a custom variable and afterwards print each of these variables.  Eventually instead of printing I plan on using these variables to configure the interfaces themselves depending on the output, but for now am happy just seeing it assign the variables correctly.</p>
  
  <p>This is how I'm trying to tackle this:</p>
  
  <pre><code>set cnt=1
  for /f "tokens=12,13*" %%f in ('ipconfig /all^|findstr "Description"') do (
    setlocal enabledelayedexpansion
    set "mess.!cnt!.name=%%h"
    endlocal
    set /a cnt+=1
    )
  echo mess.0.name
  for /l %%t in (1,1,%cnt%) do (
    echo mess.%%t.name
    echo "%mess.0.name%"
    )
  pause
  </code></pre>
  
  <p>Though I've gone through almost every conceivable approach using delayedexpansion, I cannot get the batch file to consider mess.cnt.name as a variable that increments with each loop.</p>
  
  <p>Here is a sample of the output:</p>
  
  <pre><code>C:\Users\admin\Desktop&gt;test1.bat
  
  C:\Users\admin\Desktop&gt;set cnt=1
  
  C:\Users\admin\Desktop&gt;for /F "tokens=12,13*" %f in('ipconfig /all|findstr "Des
  cription"') do (
  setlocal enabledelayedexpansion
    set "mess.!cnt!.name=%h"
    endlocal
    set /a cnt+=1
  )
  
  C:\Users\admin\Desktop&gt;(
  setlocal enabledelayedexpansion
    set "mess.!cnt!.name=AirLink USB Ethernet/RNDIS"
    endlocal
    set /a cnt+=1
  )
  
  C:\Users\admin\Desktop&gt;(
    setlocal enabledelayedexpansion
    set "mess.!cnt!.name=LAN9500 USB 2.0 to Ethernet 10/100 Adapter"
    endlocal
    set /a cnt+=1
  )
  
  C:\Users\admin\Desktop&gt;(
    setlocal enabledelayedexpansion
    set "mess.!cnt!.name=Intel(R) 82579LM Gigabit Network Connection"
    endlocal
    set /a cnt+=1
  )
  
  C:\Users\admin\Desktop&gt;echo mess.0.name
  mess.0.name
  
  C:\Users\admin\Desktop&gt;for /L %t in (1 1 4) do (
  echo mess.%t.name
  echo "Intel(R) 82579LM Gigabit Network Connection"
  )
  C:\Users\admin\Desktop&gt;(
  echo mess.1.name
  echo "Intel(R) 82579LM Gigabit Network Connection"
  )
  mess.1.name
  "Intel(R) 82579LM Gigabit Network Connection"
  
  C:\Users\admin\Desktop&gt;(
  echo mess.2.name
   echo "Intel(R) 82579LM Gigabit Network Connection"
  )
  mess.2.name
  "Intel(R) 82579LM Gigabit Network Connection"
  
  C:\Users\admin\Desktop&gt;(
  echo mess.3.name
   echo "Intel(R) 82579LM Gigabit Network Connection"
  )
  mess.3.name
  "Intel(R) 82579LM Gigabit Network Connection"
  
  C:\Users\admin\Desktop&gt;(
  echo mess.4.name
   echo "Intel(R) 82579LM Gigabit Network Connection"
  )
  mess.4.name
  "Intel(R) 82579LM Gigabit Network Connection"
  
  C:\Users\admin\Desktop&gt;pause
  Press any key to continue . . .
  </code></pre>
  
  <p>Any help on this would be much appreciated.  I've been beating my head against the wall on this for days.</p>
  
  <p>Victor</p>