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

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

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -