|As I understand it, the problem is that the last line of your first |
file is not terminated by a CR LF sequence. The file just ends
abruptly. So when you TYPE *.txt this concatenates all the
files, but because the first file doesn't end with a CR LF, the
first line of the second file gets joined to the last line of the
first file. So you get:
File 1 line 1
File 1 line 2File 2 line 1
File 2 line 2
which is 3 lines, when you are expecting 4.
This is a problem because it is not uncommon for a file's last
line not to end with CR LF, although it is highly advisable.
One possible workaround is to count the lines file-by-file:
set /a count1=0
for %%A in (*.txt) do (
for /f %%B in ('find /c /v "" ^< %%A') do set /a count1 += %%B