@echo off setlocal EnableExtensions if "%~1"=="" ( echo Usage: %~nx0 ^ exit /b 2 ) set "FILE=%~1" if not exist "%FILE%" ( echo File not found: %FILE% exit /b 2 ) if exist "%FILE%\" ( echo Path is a directory: %FILE% exit /b 2 ) set "TOTAL=0" for /f %%C in ('type "%FILE%" ^| find /c /v ""') do set "TOTAL=%%C" set /a DATA=%TOTAL%-1 if %DATA% lss 0 set /a DATA=0 echo File: %FILE% echo Lines: %TOTAL% echo Data rows: %DATA% exit /b 0