Skip to content

Commit 66349ff

Browse files
Sean Wheelerzjalexander
Sean Wheeler
authored andcommitted
reformatting About_* for 80 columns - part 5
1 parent a08dbd5 commit 66349ff

30 files changed

+6090
-4440
lines changed

reference/3.0/Microsoft.PowerShell.Core/About/about_Properties.md

Lines changed: 195 additions & 169 deletions
Large diffs are not rendered by default.

reference/3.0/Microsoft.PowerShell.Core/About/about_Redirection.md

Lines changed: 103 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,145 @@
11
---
2-
ms.date: 2017-06-09
2+
ms.date: 2017-12-01
33
schema: 2.0.0
44
locale: en-us
5-
keywords: powershell,cmdlet
5+
keywords: PowerShell,cmdlet
66
title: about_Redirection
77
---
88

99
# About Redirection
10-
## about_Redirection
11-
1210

1311
## SHORT DESCRIPTION
14-
Explains how to redirect output from Windows PowerShell® to text files.
1512

13+
Explains how to redirect output from PowerShell to text files.
1614

1715
## LONG DESCRIPTION
18-
By default, Windows PowerShell sends its command output to the Windows PowerShell console. However, you can direct the output to a text file, and you can redirect error output to the regular output stream.
1916

20-
You can use the following methods to redirect output:
17+
By default, PowerShell sends its command output to the PowerShell console.
18+
However, you can direct the output to a text file, and you can redirect error
19+
output to the regular output stream.
2120

22-
- Use the Out-File cmdlet, which sends command output to a text file. Typically, you use the Out-File cmdlet when you need to use its parameters, such as the Encoding, Force, Width, or NoClobber parameters.
21+
You can use the following methods to redirect output:
2322

24-
- Use the Tee-Object cmdlet, which sends command output to a text file and then sends it to the pipeline.
23+
- Use the `Out-File` cmdlet, which sends command output to a text file.
24+
Typically, you use the `Out-File` cmdlet when you need to use its parameters,
25+
such as the **Encoding**, **Force**, **Width**, or **NoClobber** parameters.
2526

26-
- Use the Windows PowerShell redirection operators.
27+
- Use the Tee-Object cmdlet, which sends command output to a text file and
28+
then sends it to the pipeline.
2729

30+
- Use the PowerShell redirection operators.
2831

29-
### WINDOWS POWERSHELL REDIRECTION OPERATORS
30-
The redirection operators enable you to send particular types of output to files and to the success output stream.
32+
### POWERSHELL REDIRECTION OPERATORS
3133

32-
The Windows PowerShell redirection operators use the following characters to represent each output type:
34+
The redirection operators enable you to send particular types of output to
35+
files and to the success output stream.
3336

37+
The PowerShell redirection operators use the following characters to represent
38+
each output type:
3439

3540
```
36-
* All output
37-
1 Success output
38-
2 Errors
39-
3 Warning messages
40-
4 Verbose output
41+
* All output
42+
1 Success output
43+
2 Errors
44+
3 Warning messages
45+
4 Verbose output
4146
5 Debug messages
4247
```
4348

49+
NOTE: The All (\*), Warning (3), Verbose (4) and Debug (5) redirection
50+
operators were introduced in PowerShell 3.0. They do not work in earlier
51+
versions of PowerShell.
4452

45-
NOTE: The All (\*), Warning (3), Verbose (4) and Debug (5) redirection operators were introduced in Windows PowerShell 3.0. They do not work in earlier versions of Windows PowerShell.
53+
The PowerShell redirection operators are as follows.
4654

47-
The Windows PowerShell redirection operators are as follows.
55+
```
56+
Operator Description Example
57+
-------- ---------------------- ------------------------------
58+
> Sends output to the Get-Process > Process.txt
59+
specified file.
4860
61+
>> Appends the output to dir *.ps1 >> Scripts.txt
62+
the contents of the
63+
specified file.
4964
50-
```
51-
Operator Description Example
52-
-------- ---------------------- ------------------------------
53-
> Sends output to the Get-Process > Process.txt
54-
specified file.
55-
56-
>> Appends the output to dir *.ps1 >> Scripts.txt
57-
the contents of the
58-
specified file.
59-
60-
2> Sends errors to the Get-Process none 2> Errors.txt
61-
specified file.
62-
63-
2>> Appends errors to Get-Process none 2>> Save-Errors.txt
64-
the contents of the
65-
specified file.
66-
67-
2>&1 Sends errors (2) and Get-Process none, Powershell 2>&1
68-
success output (1)
69-
to the success
70-
output stream.
71-
72-
3> Sends warnings to the Write-Warning "Test!" 3> Warnings.txt
73-
specified file.
74-
75-
3>> Appends warnings to Write-Warning "Test!" 3>> Save-Warnings.txt
76-
the contents of the
77-
specified file.
78-
79-
3>&1 Sends warnings (3) and function Test-Warning
80-
success output (1) { Get-Process PowerShell;
81-
to the success Write-Warning "Test!" }
82-
output stream. Test-Warning 3>&1
83-
84-
4> Sends verbose output to Import-Module * -Verbose 4> Verbose.txt
85-
the specified file.
86-
87-
4>> Appends verbose output Import-Module * -Verbose 4>> Save-Verbose.txt
88-
to the contents of the
89-
specified file.
90-
91-
4>&1 Sends verbose output (4) Import-Module * -Verbose 4>&1
92-
and success output (1)
93-
to the success output
94-
stream.
95-
96-
5> Sends debug messages to Write-Debug "Starting" 5> Debug.txt
97-
the specified file.
98-
99-
5>> Appends debug messages Write-Debug "Saving" 5>> Save-Debug.txt
100-
to the contents of the
101-
specified file.
102-
103-
5>&1 Sends debug messages (5) function Test-Debug
104-
and success output (1) { Get-Process PowerShell
105-
to the success output Write-Debug "PS" }
106-
stream. Test-Debug 5>&1
107-
108-
*> Sends all output types function Test-Output
109-
to the specified file. { Get-Process PowerShell, none
110-
Write-Warning "Test!"
111-
*>> Appends all output types Write-Verbose "Test Verbose"
112-
to the contents of the Write-Debug "Test Debug" }
113-
specified file.
114-
Test-Output *> Test-Output.txt
115-
*>&1 Sends all output types Test-Output *>> Test-Output.txt
116-
(*) to the success output Test-Output *>&1
65+
2> Sends errors to the Get-Process none 2> Errors.txt
66+
specified file.
67+
68+
2>> Appends errors to Get-Process none 2>> Save-Errors.txt
69+
the contents of the
70+
specified file.
71+
72+
2>&1 Sends errors (2) and Get-Process none, Powershell 2>&1
73+
success output (1)
74+
to the success
75+
output stream.
76+
77+
3> Sends warnings to the Write-Warning "Test!" 3> Warnings.txt
78+
specified file.
79+
80+
3>> Appends warnings to Write-Warning "Test!" 3>> Warnings.txt
81+
the contents of the
82+
specified file.
83+
84+
3>&1 Sends warnings (3) and function Test-Warning
85+
success output (1) { Get-Process PowerShell;
86+
to the success Write-Warning "Test!" }
87+
output stream. Test-Warning 3>&1
88+
89+
4> Sends verbose output to Import-Module * -Verbose 4> Verbose.txt
90+
the specified file.
91+
92+
4>> Appends verbose output Import-Module * -Verbose 4>> Verbose.txt
93+
to the contents of the
94+
specified file.
95+
96+
4>&1 Sends verbose output (4) Import-Module * -Verbose 4>&1
97+
and success output (1)
98+
to the success output
11799
stream.
118-
```
119100
101+
5> Sends debug messages to Write-Debug "Starting" 5> Debug.txt
102+
the specified file.
103+
104+
5>> Appends debug messages Write-Debug "Saving" 5>> Debug.txt
105+
to the contents of the
106+
specified file.
107+
108+
5>&1 Sends debug messages (5) function Test-Debug
109+
and success output (1) { Get-Process PowerShell
110+
to the success output Write-Debug "PS" }
111+
stream. Test-Debug 5>&1
112+
113+
*> Sends all output types function Test-Output
114+
to the specified file. { Get-Process PowerShell, none
115+
Write-Warning "Test!"
116+
*>> Appends all output types Write-Verbose "Test Verbose"
117+
to the contents of the Write-Debug "Test Debug" }
118+
specified file.
119+
Test-Output *> Test-Output.txt
120+
*>&1 Sends all output types Test-Output *>> Test-Output.txt
121+
(*) to the success Test-Output *>&1
122+
output stream.
123+
```
120124

121125
The syntax of the redirection operators is as follows:
122126

123-
124127
```
125128
<input> <operator> [<path>\]<file>
126129
```
127130

131+
If the specified file already exists, the redirection operators that do not
132+
append data (> and n>) overwrite the current contents of the file without
133+
warning. However, if the file is a read-only, hidden, or system file, the
134+
redirection fails. The append redirection operators (>> and n>>) do not write
135+
to a read-only file, but they append content to a system or hidden file.
128136

129-
If the specified file already exists, the redirection operators that do not append data (> and n>) overwrite the current contents of the file without warning. However, if the file is a read-only, hidden, or system file, the redirection fails. The append redirection operators (>> and n>>) do not write to a read-only file, but they append content to a system or hidden file.
130-
131-
To force the redirection of content to a read-only, hidden, or system file, use the Out-File cmdlet with its Force parameter. When you are writing to files, the redirection operators use Unicode encoding. If the file has a different encoding, the output might not be formatted correctly. To redirect content to non-Unicode files, use the Out-File cmdlet with its Encoding parameter.
132-
137+
To force the redirection of content to a read-only, hidden, or system file,
138+
use the Out-File cmdlet with its Force parameter. When you are writing to
139+
files, the redirection operators use Unicode encoding. If the file has a
140+
different encoding, the output might not be formatted correctly. To redirect
141+
content to non-Unicode files, use the Out-File cmdlet with its Encoding
142+
parameter.
133143

134144
## SEE ALSO
135145

@@ -142,4 +152,3 @@ Tee-Object
142152
[about_Command_Syntax](about_Command_Syntax.md)
143153

144154
[about_Path_Syntax](about_Path_Syntax.md)
145-

0 commit comments

Comments
 (0)