 <pre><code>set TEXT_T="myfile.txt" set /a c=1 FOR /F "tokens=1 usebackq" %%i in (%TEXT_T%) do ( set /a c+=1 set OUTPUT_FILE_NAME=output_%c%.txt echo Output file is %OUTPUT_FILE_NAME% echo %%i, %c% ) </code></pre>