forked from npocmaka/batch.scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstLinesP.bat
More file actions
31 lines (27 loc) · 933 Bytes
/
Copy pathfirstLinesP.bat
File metadata and controls
31 lines (27 loc) · 933 Bytes
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
@echo off
setlocal enableExtensions
rem ------ validate parameters ------
:: parametrized version of batch.scripts/fileUtils/firstLiles.bat
for %%H in ("/h" "-h" "-help" "/help") do if /I "%~1" EQU "%%~H" goto :help
if "%~2" EQU "" goto :help
if not exist "%~1" echo file does not exist && exit /b 3
set /a "lines=%~2"
if not defined lines echo pass a number bigger than 0 for the lines to be shown&&exit /b 1
if defined lines if %lines%0 equ 0 echo pass a number bigger than 0 for the lines to be shown&&exit /b 2
rem ---------------------------------
;break>"%temp%\empty"
@@fc "%temp%\empty" "%~1" /lb %lines% /t |more +4 | findstr /B /E /V "*****"
;del /q /f "%temp%\empty"
goto :eof
endlocal
:help
echo Displays first lines of a given file
echo.
echo %~n0 file lines
echo.
echo.
echo lines Number of lines to display.Must be bigger than 0.
echo file Specifies the file.
::
:: by Vasil "npocmaka" Arnaudov
::