Wrote a text file with 30 lines. Run the following. It got the right info but I only need the answer – 30. I am actually running through several hundred files and want just a text file with each row containing the line count of each file.
$testLOC = "c:tempThisIsATest.txt"
$rowCOUNT = Get-Content -Path $testLOC | Measure-Object -Line
$rowCOUNT
Lines Words Characters Property
—– —– ———- ——–
30
$testLOC = "c:tempThisIsATest.txt"
$rowCOUNT = Get-Content -Path $testLOC | Measure-Object -Line | Format-List -Property Lines
$rowCOUNT
Lines : 30
I can run this out into a text file and remove the "Lines :" from each entry but I would like just the "30".