Out-File
SafeSave output to a file
... | Out-File log.txt -Encoding UTF8
Writes output to a file; -Append appends. Unlike '>', encoding is explicit — no mojibake.
Examples
Get-WinEvent -LogName System -MaxEvents 100 | Out-File sys.txt -Encoding UTF8Save investigation output
Syntax
<cmd> | Out-File <path> [-Append] [-Encoding UTF8]
Before you run it
Overwrites unless -Append.
Used when you see
Related commands
- Export-CsvExport to CSV
- teeWrite to screen and 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