title: BATCH - Adding a Counter to a Function (for/loop)
body: <p>I'm using these functions in a BATCH-File:</p>
  
  <pre><code>set /p time="Enter seconds  "
  
  for /f %%C in ('Find /V /C "" ^&lt; list.txt') do set Count=%%C
  
  for /f "usebackq delims=" %%i in ("list.txt") do (
    start "" "firefox.exe" -new-tab "http://www.website.com/%%i"
    &gt;nul ping -n %time% localhost
  </code></pre>
  
  <p>I searched for a way to add a <strong>counter*</strong> to the last function, so it will tell me in the Commandbox about the progress, but all I found was a "standalone" function like this:</p>
  
  <pre><code>setlocal enableextensions enabledelayedexpansion
  SET /A COUNT=1
  FOR /F "tokens=*" %%A IN (config.properties) DO (
    SET /A COUNT+=1
    ECHO !COUNT!
  )
  endlocal
  </code></pre>
  
  <p><em>(Can be found here: <a href="https://stackoverflow.com/questions/7522740/counting-in-a-for-loop-using-dos-batch-script">Counting in a FOR loop using Windows Batch script</a>)</em></p>
  
  <p>Can you tell me how to add the 2nd function (counter) into the 1st (firefox-tab-opening)?</p>
  
  <p>*= I mean that everytime the for-Function is opening a new Tab in Firefox, the batch puts a count in the cmd.exe-Box (preferably in the same line as some kind of a overwrite instead of a new line for every count) with the total amount of lines (%Count%) behind it (like 23 / 80, when the new Tab has opened 24 / 80 and so on)</p>
  
  <p>Thank you very much for your precious time in helping me :)</p>
  
  <p>EDIT: Thought I'll share my <strong>complete non-working version</strong>:</p>
  
  <pre><code>for /f %%C in ('Find /V /C "" ^&lt; list.txt') do set TotalCount=%%C
  ECHO (List with %TotalCount% Lines)
  
  set /p time="Enter seconds  "
  
  
  
  set /a counter=1
  
  for /f "usebackq delims=" %%i in ("list.txt") do (
    start "" "firefox.exe" -new-tab "http://www.website.com/%%i" 
  
    set /a count+=1
    echo %counter% / %TotalCount%
  
    &gt;nul ping -n %time% localhost
  
  
  )
  </code></pre>
  
  <p>Problem: It gives out "1 / <em>%TotalCount%</em>" all the time! (%TotalCount% works fine)</p>