PowerTip: Use PowerShell to return first two lines of file
Summary: Learn how to use Windows PowerShell to return the first two lines of a text file.
How can I use Windows PowerShell to easily return the first two lines of a text file?
Use the Get-Content cmdlet and specify the TotalCount parameter. In this example, TotalCount is set
to 2 and the file is named AMoreComplete.txt:
Get-Content ‘C:\fso\AMoreComplete.txt’ -TotalCount 2