Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to return first two lines of file

$
0
0

Summary: Learn how to use Windows PowerShell to return the first two lines of a text file.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily return the first two lines of a text file?

Hey, Scripting Guy! Answer 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


Viewing all articles
Browse latest Browse all 3333

Trending Articles