Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Friday, November 12, 2010

What does 2>&1 mean in Powershell?

In class 50025, we noticed some odd code on page 9-2. This code 2>&1 did not come with any good description. It is a redirection operator. Below is some information on the different Powershell redirectors.

>

Redirects output to specified file. If the file already exists, current contents are overwritten.

>>

Redirects output to specified file. If the file already exists, the new output is appended to the current content.

2>

Redirects error output to specified file. If the file already exists, current contents are overwritten.

2>>

Redirects error output to specified file. If the file already exists, the new output is appended to the current content.

2>&1

Redirects error output to the standard output pipe instead of to the error output pipe.

No comments: