One of the ways to get number of lines from a file is this method in PowerShell:
PS C:\\Users\\Pranav\\Desktop\\PS_Test_Scripts> $a=Get-Content .\\sub.ps1
MS DOS command FIND : $fileName = 'C:\dirname\filename.txt' CMD /C ('find /v /c "" "' + $fileName + '"') Other variations on the find command can be found on the docs.
$fileName = 'C:\dirname\filename.txt'
CMD /C ('find /v /c "" "' + $fileName + '"')