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 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