In my understanding, (Get-Content $file | Measure-Object).count
should return the total number of lines in the file. It does for some files, but for some generated files the result it gives is less than the correct number by 1. I examines them and see that at the last line they don't have CRLF.
Why is this the case? And how to make sure that I get the correct result? The Measure-Object
documentation doesn't seem to explain this.