Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

The quickest way to save ordinary PowerShell output is:

Get-Process > .processes.txt

This creates processes.txt if it does not exist, but silently replaces its contents if it does. Use Out-File when you need options such as encoding, width, append mode, or overwrite protection. If another script or application must consume the data, use Export-Csv instead of saving the formatted screen display.

Choose the method that matches your goal

Goal Use What it does
Quick human-readable file > Redirects formatted success output to a file
Append command output >> Adds redirected output without replacing existing content
Control report output Out-File Writes formatted text with options for width, encoding, and safety
Save and keep using the pipeline Tee-Object Writes to a file while passing output onward
Replace a text file Set-Content Writes strings or lines as file content
Append text Add-Content Adds strings or lines to an existing file
Machine-readable tabular data Export-Csv Exports object properties as CSV columns

The key distinction is between a display report and the underlying objects. Out-File and redirection capture PowerShell’s formatted representation. They do not preserve the original object structure. For automation, exporting structured data is usually the better choice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save normal command output with >

Use the redirection operator for a concise one-liner:

#1 Best Overall
Lexar D40E 128GB Dual USB 3.2 Gen 1 Type-C Jump Drive, Champagne Silver
  • USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
  • Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
  • Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
  • Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
  • Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty
Get-Date > .date.txt
Get-Process > .processes.txt

PowerShell’s > operator is effectively shorthand for piping to Out-File without additional parameters:

Get-Process | Out-File -FilePath .processes.txt

Both commands create the destination file when necessary and overwrite an existing file without prompting. That behavior is convenient for disposable reports but dangerous for logs or important output. The PowerShell redirection documentation describes the operators and their stream behavior.

Append output instead of overwriting it

Use >> to append redirected command output:

Get-Date >> .activity.log

The explicit Out-File form is:

Get-Date | Out-File -FilePath .activity.log -Append

These methods append the command’s formatted output. When you already have text rather than command objects, use Add-Content:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Add-Content -Path .activity.log -Value "Backup completed"

>> and Out-File -Append are useful for redirected command output; Add-Content is designed for adding strings, lines, or other file content. See Microsoft’s documentation for Add-Content.

Prevent accidental overwrites

Use -NoClobber with Out-File when an existing file should cause an error:

Get-Process |
    Out-File -FilePath .processes.txt -NoClobber

For a report that should always be new, generate a timestamped filename:

$path = ".report-$((Get-Date).ToString('yyyyMMdd-HHmmss')).txt"
Get-Process | Out-File -FilePath $path

You can also check explicitly:

if (Test-Path .report.txt) {
    throw "Report already exists."
}

Get-Process | Out-File .report.txt

Unlike Out-File -NoClobber, redirection with > does not provide a built-in confirmation prompt.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
SANDISK 128GB Ultra Flair, USB-A Flash Drive, Up to 150MB/s Read Speeds
  • High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
  • Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
  • Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
  • Sleek, durable metal casing
  • Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]

Save output and still display it

Out-File consumes the pipeline output and writes it to the file. It does not pass those objects to later pipeline commands. Use Tee-Object when you want to log output while continuing to process it:

Get-Process |
    Tee-Object -FilePath .processes.txt

If Tee-Object is the final command, the output is written to the file and displayed in the console. It can also feed a later command:

Get-Process |
    Tee-Object -FilePath .processes.txt |
    Where-Object CPU -gt 100

Append with -Append:

Get-Process |
    Tee-Object -FilePath .processes.log -Append

Read the Tee-Object documentation for its file and pipeline behavior.

Capture errors as well as successful output

PowerShell separates output into streams. The normal success stream is stream 1, while errors are stream 2. Redirecting with > captures success output only.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save errors in a separate file:

Get-Item .missing-file.txt 2> .errors.txt

Append errors instead:

Get-Item .missing-file.txt 2>> .errors.txt

To save normal output and errors together:

Get-Item .missing-file.txt > .all-output.txt 2>&1

The order matters. First, > sends stream 1 to all-output.txt. Then 2>&1 sends stream 2 to the same destination as stream 1. Another common form is:

Get-Item .missing-file.txt *>&1 | Out-File .all-output.txt

PowerShell’s stream redirection resembles redirection in other shells but is not identical to Bash or traditional command prompt behavior. The official redirection reference lists the supported stream numbers and operators.

Write strings, variables, and multiple lines

Use Set-Content when your input is already text and you want to replace the file:

Rank #3
2 Pack 64GB USB Flash Drive USB 2.0 Thumb Drives Jump Drive Fold Storage Memory Stick Swivel Design - Black
  • What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
  • Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
  • Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
  • Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
  • Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers
"Server backup completed" | Set-Content -Path .status.txt

Or provide the value directly:

Set-Content -Path .status.txt -Value "Server backup completed"

Use Add-Content to append:

Add-Content -Path .status.txt -Value "Second status line"

An array is useful for writing several lines at once:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$lines = @(
    "Started: $(Get-Date)"
    "Status: Complete"
)

Set-Content -Path .status.txt -Value $lines

To omit the automatic final newline when appropriate:

Set-Content -Path .status.txt -Value "No final newline" -NoNewline

Set-Content replaces existing content; Add-Content appends. These cmdlets are better fits than Out-File for generated text because they are content-oriented rather than display-oriented. See the documentation for Set-Content and Add-Content.

Export PowerShell objects to CSV

Use Export-Csv when a spreadsheet, script, database import, or another program needs individual columns and values:

Get-Process |
    Select-Object Name, Id, CPU, WorkingSet |
    Export-Csv -Path .processes.csv -NoTypeInformation

Select-Object defines a deliberate, stable set of columns instead of exporting every property exposed by the command. The result is data that can be imported and processed more reliably than a formatted text table.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not format objects before exporting them:

# Suitable for structured data
Get-Process |
    Export-Csv .processes.csv -NoTypeInformation

# Usually wrong for CSV
Get-Process |
    Format-Table |
    Export-Csv .processes.csv

Format-Table and other Format-* cmdlets prepare objects for presentation. If they run before Export-Csv, the CSV may contain formatting metadata instead of the process properties you expected. Export first; format only when producing a human-readable report. CSV is appropriate for tabular data, but nested or complex properties may need preprocessing. See Export-Csv.

Control encoding

Encoding matters when another application reads the file, especially when it contains non-ASCII characters. In current PowerShell 7.x documentation, utf8NoBOM is the default for Out-File, Tee-Object, and relevant content cmdlets. You can still make the choice explicit:

Rank #4
SIMMAX 32GB Memory Stick USB 2.0 Flash Drives Swivel Thumb Drive Pen Drive (32GB Purple)
  • GOOD VALUE PACKAGE - 1 Pack 32GB Memory Stick USB 2.0 Flash Drives with great cost performance and high quality.
  • BIG CAPACITY - The available capacity: 29.10GB-29.8GB, You can save the data of movies, music, photos, designs, programs, manuals, handouts in a high speed.Good performance in digital data storing, transferring and sharing with families, friends, workmates, clients and machines.
  • EASY TO USE & PLUG AND WORK - Support windows 7 / 8 / 10 / Vista / XP / 2000 / ME / NT Linux and Mac OS, Compatible with USB2.0 and below.
  • TWISTTURN DESIGN & EASY CARRY - The metal clip rotates 360° round the ABS plastic body which with rubber oil skin feeling finish. The capless design can avoid lossing of cap, and providing efficient protection to the USB port.
  • WARRANTY & SUPPORT - SIMMAX logo is laser printed on the USB connector surface, our products are of good quality and we promise that any problem about the product within one year since you buy.
Get-Process |
    Out-File -FilePath .processes.txt -Encoding utf8

For a UTF-8 byte-order mark:

Get-Process |
    Out-File -FilePath .processes.txt -Encoding utf8BOM

For a legacy consumer that requires ASCII:

Get-Process |
    Out-File -FilePath .processes.txt -Encoding ascii

-Encoding ansi is available beginning with PowerShell 7.4. Do not recommend UTF-7 for new scripts; modern PowerShell warns about it.

Windows PowerShell 5.1 has materially different default-encoding behavior from PowerShell 6 and later. Therefore, scripts that exchange files with other systems should specify an encoding and test it with the consuming application rather than relying on an unspecified default. Appending does not automatically detect and match the encoding already present in a file. Microsoft’s character-encoding guidance covers these version differences.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix truncated columns and long values

Redirection and Out-File use PowerShell’s formatting system. Table views can be constrained by the console width, so long values or columns may be cut off in the saved report.

Increase the output width:

Get-ChildItem Env:Path |
    Out-File -FilePath .path.txt -Width 2000

To set a script-wide default for Out-File:

$PSDefaultParameterValues['Out-File:Width'] = 2000

This setting also affects redirection operators because they behave like Out-File without additional parameters. However, increasing width is not a universal solution. If information was discarded by an earlier formatting operation, -Width cannot restore it. For extraction and automation, select properties and use Export-Csv instead.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Handle paths and missing directories

Out-File can create the file, but it generally does not create a missing parent directory. Create the directory first:

$directory = '.reports'
New-Item -ItemType Directory -Path $directory -Force | Out-Null
Get-Process | Out-File "$directoryprocesses.txt"

When a filename contains wildcard characters such as square brackets, use -LiteralPath with cmdlets that support it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Get-Process |
    Out-File -LiteralPath '.report[2026].txt'

-LiteralPath treats the path as written instead of interpreting wildcard characters. Provider-specific behavior can vary, so use a normal filesystem path when possible.

Best Value
IMEASON Swivel Design 16GB USB Flash Drive with Keychain, USB 2.0 Portable Thumb Drive Memory Stick, FAT32 Format Flashdrive for Data Storage, Photos, Music, Files (Black, 16 GB)
  • 【16GB Flash Drive】USB flash drives with 16GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer. IMEASON thumb drives can be used to store different files, easy to data backup.
  • 【Metal Swivel Cap Design】USB thumb drive is metal swivel cover provides extra protection for the usb thumbdrive connector, no usb drive cap to lose; keychain design makes it easier to carry without worrying lose it.
  • 【Wide Compatibility】USB drive supports Windows 7/8/10/11 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also Supports USB 2.0 and 1.1 ports. USB Stick support TV, desktop, notebook computer, car, audio and other device. The USB Memory Stick is your great data storage and transfer companion with traveling and working.
  • 【Easy to use】usb memory stick is plug and play without any software installation. Just simply plug the Flashdrive into the port of your USB-compatible devices such as computer, laptop to start data storage or transmission.
  • 【What You Get】16 GB USB Flash Drive Thumb Drive, The default format of the usb storage flash drive is FAT32.

PowerShell 7.4 and native-command redirection

PowerShell 7.4 changed redirection for the standard output of native commands. It now preserves byte-stream data instead of having PowerShell interpret and reformat it as PowerShell output.

That distinction matters for native executables, particularly when they emit carefully controlled bytes or non-text data:

some-native-program.exe > .output.bin

This is not the same scenario as redirecting a normal PowerShell cmdlet:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Get-Process > .processes.txt

For ordinary cmdlets, redirection remains tied to PowerShell’s output streams and formatting behavior. Do not assume every command has identical file-output semantics. Refer to the current redirection documentation when handling native byte streams.

A practical troubleshooting checklist

  • The old file disappeared: You used >, Out-File, or Set-Content, all of which replace existing content by default. Use >>, -Append, or -NoClobber as appropriate.
  • Errors are missing: Success output was redirected, but stream 2 was not. Use 2> for a separate error file or > file.txt 2>&1 for a combined file.
  • The file is a table, not reusable data: Replace Out-File with Select-Object ... | Export-Csv.
  • Columns are cut off: Use -Width for a display report, or export selected properties as CSV.
  • The file will not open correctly: Specify a compatible -Encoding, taking into account whether you are running Windows PowerShell 5.1 or PowerShell 7.x.
  • The command fails because the folder is absent: Create the parent directory with New-Item -ItemType Directory -Force.
  • Later pipeline commands receive nothing: Out-File ends the useful object flow. Use Tee-Object when you need to save and continue.

Verify the result

For a text report, read the saved file back:

Get-Content .processes.txt

If you need to investigate bytes or a possible encoding issue, inspect the file in hexadecimal form:

Format-Hex .processes.txt

In most workflows, though, the important decision is made before writing: choose formatted text for people and structured export for programs.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.