Powershell Tip #52: Count the number of lines of a file By powershellgu | October 6, 2015 0 Comment Tip: You can easily count the number of lines of a file that way : PowerShell Get-Content -Path $file | Measure-Object -Line 1 Get-Content -Path $file | Measure-Object -Line There are also other switch parameters we can use to count the number of words or characters for example.