Count number of lines in a file using DOS

To count the number of lines in a file using DOS, use the following command. Replace filename.txt with the actual filename.
findstr /R /N "^" filename.txt | find /C ":"
This is especially useful when the file is very large (say, over 250k lines) and using NotePad to open the file would definitely hang. Just tested the command on a 1.4M lines file and it took about 2 minutes to give me the result.

Leave a Comment

Please answer question below to verify that you are a real person *