@echo off setlocal enabledelayedexpansion for /f "delims=" %%i in (yourfile.txt) do ( @set /a b+=1 @echo %%i > lastline.txt ) @pause
@echo off setlocal enabledelayedexpansion for /f "delims=" %%i in (yourfile.txt) do ( @set /a b+=1 @echo %%i > lastline.txt ) @pause