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

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -