Set-Content / Add-Content
CautionWrite file contents
Set-Content <file> -Value <text>
Writes (Set) or appends (Add) content; Get→transform→Set is the config-editing pattern. Set the encoding.
Examples
(Get-Content app.conf) -replace 'debug=1','debug=0' | Set-Content app.confRewrite a config value
Syntax
Set-Content <path> -Value v [-Encoding UTF8] / Add-Content(追記)
Before you run it
Set replaces everything — keep a copy.
Related commands
- Get-ContentRead/follow file (PS)
- Out-FileSave output to a file
The same reference, with no signal at all
Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store