How to count no of lines in text file and store the value into a variable using batch script?

前端 未结 16 1209
青春惊慌失措
青春惊慌失措 2020-11-27 14:28

I want to count the no of lines in a text file and then the value has to be stored into a environment variable. The command to count the no of lines is

findstr /R         


        
16条回答
  •  抹茶落季
    2020-11-27 15:18

    @Tony: You can even get rid of the type %file% command.

    for /f "tokens=2 delims=:" %%a in ('find /c /v "" %_file%') do set /a _Lines=%%a
    

    For long files this should be even quicker.

提交回复
热议问题