JAEN

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