Set-Content
- Description
- Writes new content or replaces existing content in a file.
- Syntax
Set-Content [-Path] <String[]> [-Value] <Object[]> [-Force] [-PassThru]
- Example
Set-Content -Path 'C:\temp\output.txt' -Value 'Hello World'
- Parameters
- Path: Required. Specifies the path of the item that receives the contentValue: Required. Specifies the new content for the itemForce: Optional. Forces the command to run without user confirmationPassThru: Optional. Returns content object representing the content
- Return type
- None or System.String
- Aliases
- sc
- Supported Windows versions
- Windows PowerShell 2.0 and laterWindows 7Windows 8Windows 10Windows 11Windows Server 2008 R2 and later