Hi There,
I need some help on reading a file content using a batch file.
For example, I would like to read the first 3 lines from a txt file and also remove those lines from the original file. So that i can use that file to read the next 3 lines next time by looping...
So my mission is to read the txt file 3 lines each time. Could someone help me on this?
Regards - Pradeep
Read only first few lines from txt
Moderator: DosItHelp
it's blank:
Code: Select all
@echo off
setlocal enableextensions enabledelayedexpansion
set "i=1"
for /f "delims=" %%l in (file.txt) do (
if !i! LSS 4 (
echo line!i!: "%%l"
set /a i=!i!+1
)
if "!i!"=="4" (
set "i=1"
pause
)
)