Get-Content
- Description
- Gets the content of the item at the specified location.
- Syntax
Get-Content [-Path] <String[]> [-ReadCount <Int64>] [-TotalCount <Int64>] [-Tail <Int32>]
- Example
Get-Content -Path 'C:\logs\app.log' -Tail 50
- Parameters
- Path: Required. Specifies the path to an item where content is retrievedReadCount: Optional. Specifies how many lines to read at a timeTotalCount: Optional. Specifies the total number of lines to getTail: Optional. Gets the specified number of lines from the end
- Return type
- System.String
- Aliases
- gc, cat, type
- Supported Windows versions
- Windows PowerShell 2.0 and laterWindows 7Windows 8Windows 10Windows 11Windows Server 2008 R2 and later