Counter in Batch file for loop - how to keep the number in the same place?
<p>I'm writing a batch file in Windows. I need to process a big text file line by line. I'd like to show a counter in the <code>cmd</code> window while doing this. The following code works pretty good:</p>

<pre><code>@echo off
setlocal enableextensions enabledelayedexpansion
set /a count=1

for /f "tokens=*" %%A in (myFile.txt) do (
    set /a count+=1
    echo.!count!
)
</code></pre>

<p>The only problem is that I get a <strong>new line for every count increment</strong>. So the output in the <code>cmd</code> window is something like this:</p>

<pre><code>---------------------
-   START PROCESS   -
---------------------
1
2
3
4
..
1000
</code></pre>

<p>What I really want is <strong>a dynamic number displayed</strong> in the terminal window. Something like this:</p>

<pre><code>---------------------
-   START PROCESS   -
---------------------
count = 124           &lt;= this number should dynamically increment
</code></pre>

<p>How do I do that?</p>

<p><strong>EDIT :</strong></p>

<p>The post <a href="https://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line">Windows batch: echo without new line</a> does explain how to make an echo without starting a new line in the terminal. So this is how I tried to implement it:</p>

<pre><code>@echo off
setlocal enableextensions enabledelayedexpansion
set /a count=1

for /f "tokens=*" %%A in (iconOldPathList.txt) do (
    set /a count+=1
    &lt;nul set /p =!count!
)
</code></pre>

<p>Unfortunately, the result is not a dynamically updating number. What I get is:</p>

<pre><code>---------------------
-   START PROCESS   -
---------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
...
</code></pre>

<p>What I really want is:</p>

<pre><code>---------------------
-   START PROCESS   -
---------------------
count = 124           &lt;= this number should dynamically increment
</code></pre>