jeudi 9 août 2018

get a batch file to tell me how many line are in a csv file

I have a batch file that I am using for a toad automation. the batch file should be simple enough but it isn't liking the if statuement for some off reason I even tried the GTR example but sadly nothing all I get on the if statement is that the syntax is incorrect and do not know why.

    @Echo off
    Set _File=ExportDiffFile.csv
    Set /a _Lines=0
    For /f %%j in ('Find "" /v /c ^< %_File%') Do Set /a _Lines=%%j
    REM Echo %_File% has %_Lines% lines.

    if "%_Lines%"=="1"(
        Echo %_File% has no new lines.
        Echo 100.
        REM exit 100
    )
    else
    (
        Echo %_File% has %_Lines% new lines.
        Echo adding into the server.
        REM exit 0
    )

Aucun commentaire:

Enregistrer un commentaire