PowerShell

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

Fixing mojibake
3
Write outputs with an explicit encoding
See the whole flow →

Related commands

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