Out-File
noun
say it: “OWT FYLE” /ˈaʊt ˈfaɪl/
A PowerShell command that saves a command's output in a file, laid out as it looks on screen; it's what > uses.
What does Out-File do?
Out-File takes whatever a command would print and saves it in a file, laid out exactly as on the screen. It's what > does for you; -Append adds to the end like >>, and -Encoding chooses the text encoding. Use it at the end of a pipeline.
Get-ChildItem hallway | Out-File hallway-list.txt
In a sentence
- “With -Append, Out-File adds to the end of the file instead of replacing it.”
- “Sam ended the pipeline with Out-File to keep the hallway's list in a file.”
Level: Apprentice · More PowerShell terms at this level
Updated