Out-File

PowerShell execution T1059.001

Send pipeline output to a file. Alternative to Set-Content with pipeline support — used to write payloads, scripts, or exfiltrated data to disk.

Binary Paths

  • PowerShell cmdlet

Glob Patterns

Pattern Notes
& (gcm O*-F*) -FilePath C:\out.txt
Wildcards on both verb and noun
& (gcm Out-Fil*) -FilePath C:\out.txt
Star suffix matches 'e'
& (gcm O?t-File) -FilePath C:\out.txt
Single char wildcard replaces 'u'
& (gcm *-File) -FilePath C:\out.txt
Prefix wildcard — add -CommandType Cmdlet to avoid matching aliases
'payload' | & (gcm O*-F*) -FilePath C:\payload.ps1
Pipeline form — writes string to file via glob-resolved Out-File
& (gcm O[t-v]t-File) -FilePath C:\out.txt
Character range [t-v] matches 'u' in Out — only character in range that satisfies Out-File
& (gcm ('{0}ut-{1}' -f 'O','File')) -FilePath C:\out.txt
-f format operator constructs 'Out-File' from string fragments before gcm resolves it

Pattern Tester

$

Try typing Out-File or a full path like PowerShell cmdlet

YARA Rule

Auto-generated detection rule for Out-File

      

Platform Notes

Out-File writes pipeline output to a file. Key differences from Set-Content: accepts pipeline input directly, uses the console encoding by default, and supports -Append. The -Encoding parameter controls output encoding. Useful for writing scripts to disk: 'IEX ...' | Out-File payload.ps1.

Resources

← Previous New-Object Catalog Next → Remove-Item