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

PowerTip: Read First Line of File with PowerShell

$
0
0

Summary: Learn how to read only the first line of a file by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to read only the first line of a file?

Hey, Scripting Guy! Answer Introduced in Windows PowerShell 3.0, you can use the -First parameter, for example:

Get-Content C:\fso\batteryReport.txt -First 1


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>