title: Windows Batch: Loop through to echo a set of variables
body: <p>I have a batch file that contains the code below which assigns a variable for each line in a text file.</p>
  
  <p>So the text file might have:</p>
  
  <pre><code>RELEASE1
  RELEASE2
  RELEASE3
  </code></pre>
  
  <p>The batch file sets each line in the text file to var1, var2, var3 with the following code:</p>
  
  <pre><code>@echo off
  setlocal ENABLEDELAYEDEXPANSION
  set vidx=0
  for /F "tokens=*" %%A in (sites.txt) do (
      SET /A vidx=!vidx! + 1
      set var!vidx!=%%A
  )
  </code></pre>
  
  <p>I need a method to echo all the defined variables. The number of variables will always change. So it might go up to var8 or var10 etc...</p>
  
  <p>I'm pretty certain a for loop would do the trick but not sure what the best approach or how to do it? I was thinking of using vidx as the number of iterations? Thanks for your help!</p>