title: Batch-Script - Iterate through arguments
body: <p>I have a batch-script with multiple arguments. I am reading the total count of them and then run a for loop like this:</p>
  
  <pre><code>@echo off
  setlocal enabledelayedexpansion
  
  set argCount=0
  for %%x in (%*) do set /A argCount+=1
  echo Number of processed arguments: %argCount%
  
  set /a counter=0
  for /l %%x in (1, 1, %argCount%) do (
  set /a counter=!counter!+1 )
  </code></pre>
  
  <p>What I want to do now, is to use my running variable (<code>x</code> or <code>counter</code>) to access the input arguments. I am thinking aobut something like this:</p>
  
  <pre><code>REM Access to %1 
  echo %(!counter!)
  </code></pre>
  
  <p>In an ideal world this line should print out my first command line argument but obviously it doesn't. I know I am doing something wrong with the <code>%</code> operator, but is there anyway I could access my arguments like this?</p>
  
  <p>//edit: Just to make things clear - the problem is that <code>%(!counter!)</code> provides me with the value of the variable <code>counter</code>. Meaning for <code>counter=2</code> it gives me <code>2</code> and not the content of <code>%2</code>.</p>