Skip to content

Instantly share code, notes, and snippets.

@LarryWeiss
Last active March 21, 2019 20:35
Show Gist options
  • Save LarryWeiss/246bb72704619569fa1307e79eccfd23 to your computer and use it in GitHub Desktop.
Save LarryWeiss/246bb72704619569fa1307e79eccfd23 to your computer and use it in GitHub Desktop.
------------------------------------------------------------------------------------------------
output redirection to Unicode text where
α is a command
ß and γ are file names or PowerShell variable names
α > ß only regular output - override
α >> ß only regular output - append
α 2> ß only error output - override
α 2>> ß only error output - append
α 2>&1> ß both regular output and error output, merged - overide
α 2>&1>> ß both regular output and error output, merged - append
α >ß 2>γ both regular output and error output, separately - both override
α >>ß 2>>γ both regular output and error output, separately - both append
α >ß 2>>γ both regular output and error output, separately - regular override, error append
α >>ß 2>γ both regular output and error output, separately - regular append, error override
------------------------------------------------------------------------------------------------
The PowerShell redirection operators use the following characters to represent each output stream.
Here is the full set of streams available for `>` redirection:
* All
1 Success Write-Output
2 Errors Write-Error
3 Warnings Write-Warning
4 Verbose Write-Verbose
5 Debug Write-Debug
6 Informational Write-Host in pswh, and Write-Information in PowerShell 5
------------------------------------------------------------------------------------------------
introduced in Windows PowerShell 3.0: All (*), Warning (3), Verbose (4) and Debug (5)
introduced in Windows PowerShell 5.0: Informational messages (6)
------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment