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
You don't need to use find.
@echo off set /a counter=0 for /f %%a in (filename) do set /a counter+=1 echo Number of lines: %counter%
This iterates all lines in the file and increases the counter variable by 1 for each line.