Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR BASIC

how to simulate tail in dos/cmd without tail

REM tail.bat
REM
REM Usage: tail.bat <file> <number-of-lines> 
REM
REM Examples: tail.bat myfile.txt 10
REM           tail.bat "C:My FileWithSpaces.txt" 10

@ECHO OFF
for /f "tokens=2-3 delims=:" %%f in ('find /c /v "" %1') do (
    for %%F in (%%f %%g) do set nbLines=%%F )
set /a nbSkippedLines=%nbLines%-%2
for /f "usebackq skip=%nbSkippedLines% delims=" %%d in (%1) do echo %%d
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #simulate #tail #tail
ADD COMMENT
Topic
Name
5+2 =