This is my code to count lines, I only have 69 lines which has a value on each line:
Get-AppPackage | Select-Object -Property name, publisherid | Measure-Object -Property name -line
Output:
Lines Words Characters Property
----- ----- ---------- --------
71 Name
But it's counting enters as well which I don't need them.
Help?
Building on the helpful comments:
Your code doesn't count lines. It counts the number of
.Nameproperty values whose stringified representation results in non-empty strings, because you're combiningMeasure-Object's-Lineswitch with (non-string) object input and a-Propertyargument..Nameproperty contains neither the empty string nor$null, use the following - but note that this should be true of all objects returned byGet-AppPackage: