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

前端 未结 16 1244
青春惊慌失措
青春惊慌失措 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:12

    for /f "usebackq" %A in (`TYPE c:\temp\file.txt ^| find /v /c "" `) do set numlines=%A

    in a batch file, use %%A instead of %A

提交回复
热议问题