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 and flow from this site, held on your device and searchable with no connection. Free to install, no ads.
Get it free on the App Store