Get-Content

Description

Gets the content of the item at the specified location.

Command
Get-Content
Examples
Display the content of a file
Get-Content -Path .\MyFile.txt
Get the first 10 lines of a file
Get-Content .\MyFile.txt -TotalCount 10
Get the last 5 lines and keep watching for new lines
Get-Content .\MyLog.log -Tail 5 -Wait
Parameters
Parameter Type Required Description
[-Path <String[]>] string No Specifies the path to an item.
[-TotalCount <Int64>] string No Specifies the number of lines to get from the beginning of a file.
[-Tail <Int32>] string No Specifies the number of lines to get from the end of a file.
[-Wait] string No Waits for the content to be appended to the file. Similar to 'tail -f'.
Command Info
Category: File System
Type: Powershell
Views: 12
Status: Active
Tags
powershell read file text cat type gc