PowerTip: Read First Line of File with PowerShell
Summary: Learn how to read only the first line of a file by using Windows PowerShell.
How can I use Windows PowerShell to read only the first line of a file?
Introduced in Windows PowerShell 3.0, you can use the -First parameter, for example:
Get-Content C:\fso\batteryReport.txt -First 1