Why am I getting an error while running a .BAT file? -
the code follows:
@echo off set _file=sqlquery.txt set /a _lines=0 /f %j in ('type %_file%^|find "" /v /c') set /a _lines=%j echo %_file% has %_lines% lines.
when run .bat file, gives me error 'the syntax of command incorrect', , when run above commands runs successfully. why so?
try this:
@echo off (set _file=sqlquery.txt) (set _lines=) /f %%i in ('find /v /c ""^<"%_file%"') (set _lines=%%i) if defined _lines echo(%_file% has %_lines% line(s). pause
Comments
Post a Comment