In a previous post, I talked about how to count the number of lines in a text file. I explained the technique of piping the output from
type file.txt into
find /c /v "" and wrapping the whole thing inside a
for /f loop to store the result in a variable. A simple and effective solution to a common Batch programming task. 🙂
Too bad it doesn’t work…
I have of late, wherefore I know not, started writing little Batch programs. Batch is ugly and buggy, but at the same time its raw minimalism makes it capable of performing surprisingly complicated tasks. Ah, but knowing how to exploit this power, therein lies the rub!
Let's start with the seemingly straightforward task of counting the lines in a text file and storing the result in a variable.