Skip to content

Commit 2b207fe

Browse files
author
Sean Wheeler
authored
Merging latest updates into Live (#1927)
* Update the example of `Where-Object -IsNot` (#1841) * Update Example 5 in Group-Object.md (#1845) * removing @{Text=} tags * fixing UTF8 characters * removed empty H3 * added H3 for input and output types * removed mangled UTF8 character * updating Out-* commands with -NoNewLine per Issue 1739 * Fix the example of `Format-Table -DisplayError` (#1848) The example is a `-DisplayError` parameter example. But it uses `-ShowError` parameter. * Fix the example of `Format-Wide -DisplayError` (#1850) * Fix the example of `Format-Custom -DisplayError` (#1849) The example is a -DisplayError parameter example. But it uses -ShowError parameter. * updating set-acl docs per PR#901 * using semantic link breaks * Fix the example of `Format-Wide -ShowError` (#1851) * Fixed Test-ScriptFileInfo example (#1852) * fixing issue 1768 * Formatting, example fix for Body parameter (#1847) 1. Replaced variable names with PascalCase convention and for consistency 2. Removed directory information [c:\] in the examples 3. Put powershell keyword for formatting examples 4. Replaced Invoke-RestMethod with Invoke-WebRequest in the Body example, added method Post 5. Removed InformationAction and InformationVariable parameters, which were mistakenly a copy of Body, included already in CommonVariables part * fixing style consistency across articles * Fix example numbers in Resume-Job.md (#1857) Example 4 is duplicated. * Fixes typo $WebSiteName in separatingEnvData.md (#1856) - Adds the website name to common node property inside configuration data. - Also, it is now referenced (e.g. $Node.WebSiteName) in the DSC configuration document in MyWebApp.ps1. * Updates configurations.md (#1855) Two set of changes made. - Example scripts e.g. MyDscConfiguration.ps1 define the configuration inside them and call the configuration at the end line. Removed the call to the configuration at the end. Since the article demonstrates dot-sourcing the file and calling the configuration explicitly. - Fixed typo in the file name (TEST-PC1.mof to localhost.mof ), since the ComputerName was not specified it should default to using 'localhost' as the default argument for it. P.S. - There is a comment on the web-page regarding the fixes made * Fix typo in comment (#1854) * Updating the help content for v6. (#1853) * Updating the help content for v6. * Address code review comments * Fix broken links * Fix example numbers in about_Transactions.md (#1859) Example number '7' is duplicated. * Update Alias-Provider.md (#1831) 1. Removed statement that an alias is to an executable, the definition cotnains the path. It may - but does not need to be. For example: Try Set-Alias np Notepad then look at the definition. 2. Clarified that an alias can also be to a powershell script (ps1 file). 3. Tidied up the language removing multiple 'And,' clauses to improve readability. * Add documentation of new -AsHashtable switch for ConvertFrom-Json introduced by PR #5043 (#1858) * add documentation of new -AsHashTable switch for ConvertFrom-Json and also document the behaviour in case of duplicate strings. * correct casing of -AsHashtable switch. * Address PR comments about -AsHashtable switch for ConvertFrom-Json.md * Accept pipeline input: False for -AsHashtable switch in ConvertFrom-Json.md * Revert "Accept pipeline input: False for -AsHashtable switch in ConvertFrom-Json.md" Accidentally change the wrong field. This reverts commit 6e76191. * Accept pipeline input: False for -AsHashtable switch in ConvertFrom-Json.md * Fix example numbers in Invoke-WebRequest.md (#1862) Example number '4' is duplicated. * reformatting and integrating changes from PR#1831 (#1860) * Fix example numbers in Get-Help.md (#1869) Example number 12 and 13 are missing. * Fix example numbers in Import-Module.md (#1868) Example number '10' is duplicated. * Fix example number in ConvertTo-Html.html (#1867) Example number '10' is duplicated. * Update dscCiCd.md (#1865) Missing a period on line 378. Should be `$(Build.ArtifactStagingDirectory)\` not `$(BuildArtifactStagingDirectory)\`. * Web Cmdlets 6.0.0 Documentation Refresh (#1870) * Web Cmdlets 6.0.0 Documentation Refresh * Address PR Feedback * Merge Example 4 and 5 in Get-Member.md (#1874) Example 4 and 5 in Get-Member.md v3.0 and v4.0 are almost the same. They should be merged as with v5.0. * Remove hash algorithms unsupported in v6.0 (#1873) MACTripleDES and RIPEMD160 are no longer supported in v6.0. * Update outputs of Get-Verb (#1872) Since v6.0, `Get-Verb` returns not MemberDefinition but VerbInfo that has Verb and Group properties. * Fix typo in ConvertTo-Html.md (UTF-x) (#1879) * Fix "Accept wildcard characters" in Get-Service.md v6 (#1878) * Fixed "False" -> "True" (`DisplayName`, `Exclude`, `Include`, and `Name`) * Removed `InformationAction` and `InformationVariable` * Fixed Get-WindowsFeature cmdlet HyperLink (#1877) * Fixed Get-WindowsFeature cmdlet HyperLink Minor edit. Update Get-WindowsFeature cmdlet HyperLink to https://technet.microsoft.com/library/jj205469(v=wps.630).aspx * Changed URL to new docs.microsoft.com location The TechNet URL did not work. TechNet and MSDN are being retired. * Update Get-WinEvent.md (#1876) Removed future tense in a couple of places to improve readability. Minor edit. * Update Example 8 in Get-Process.md (find the owner of a process) (#1875) * Update Example 8 in Get-Process.md (Find the owner of a process) * Update to attempt to avoid build errors It seems that the build system does not accept multiple script blocks per one Example header. * updated localmachine\Root to LocalMachine\My (#1880) The example where we import the PFX on the target node should import the cert into Personal store and not root. * Update Group property example in Get-Verb.md (#1881) * adding missing space (#1885) * removing stray character (#1886) * Update Example 9 in Get-Process.md (#1888) * powershell -> pwsh (only v6.0) * Windows PowerShell -> PowerShell * Remove "About ISE" files of v6.0 (#1891) * Remove "About ISE" files of v6.0 ISE is no longer bundled with PowerShell 6.0. * Remove links for "About ISE" files of v6.0 * Update Get-Process.md (#1890) Fixed name parameter details to show it accepts wildcards in the name * Update productincompat.md (#1892) The list of compatible systems should include Skype For Business Server 2015 and Lync Server 2013. * Update unapproved verbs examples in Get-Verb.md (#1896) * Updated Example 4 * Removed Example 5 * Removing extra space in the Example 5A script (#1894) It was highlighting as string in the documentation, I was trying to remove all the extra space. * fixing merge conflict * updates to style and contrib * tweak format * tweak format 2 * fix typo * fix number list example * adding review feedback * fix broken links * incorporating feedback from zach * reformatting About_* for 80 columns - part 1 * reformat about_* * reformatting About_* topics - Part 2 * fixing broken links * fixing more broken links * more broken links fixed * Fix parameter's position in Get-Random.md (#1901) * Fix parameter's position in Measure-Command.md (#1905) * Fix parameter's position in Trace-Command.md (#1904) * Actually call the configuration in the example (#1906) On line 74, it says... "The last line of the example containing only the name of the configuration, calls the configuration." This change actually makes that call. * reformatting About_* for 80 columns - part 3 (#1902) * reformatting About_* * reformatting About_* part 3 * fixing broken links * fixing more broken links * one more time with the links * reformatting About_* for 80 columns - part 4 * Adding PreRelease versioning info for PSGallery & PSGet (#1903) * PowerShellGet PreRelease Support Adding descriptive doc for pre-release versioning support * Correcting typos in pre-release doc Minor typos and case issues fixed * Updated prerelease info based on feedback Mostly cosmetic updates. Functional change: added line 28, stating we only support 3-segment module versions. * Adding prerelease to module install update find save commands * Updating PSGet -Script commands for Prerelease support * Hyphen listed as optional rather than preferred in Prereleasestring * Minor corrections from Rebro review * Addressing @sdwheeler feedback on links and double slashes * Fixing broken link * Update PreReleaseScript.md * Style tweaks in STYLE.md (#1913) * Fix YAML metadata on "Understanding Concepts" (#1911) I'm not quite sure what this means, but it certainly looks terrible on docs.microsoft.com when it's malformed. (To be perfectly honest, I only managed to even figure out it's called "YAML metadata" by peeking at the DOM of github's HTML.) * Fix parameter's position in Join-Path.md (#1909) * typo correction on line 85 (#1916) E:\Windows\Sytem32 sould be E:\Windows\System32 * Fix parameter's position in Get-TraceSource.md (#1917) * Changed required PSGet version to 1.6.0 (#1920) * Update Example 5 in Get-Process.md (#1923) * fixing backlashes reported in PR1921 (#1924) * fixing backlashes reported in PR1921 * found more backslashes * reformatting About_* for 80 columns - part 5 * reformatting About_* for 80 columns - part 6 * incorporating review feedback * reformatting About_* for 80 columns - part 7 * Fixed formatting of output per issue #808
1 parent 58371ab commit 2b207fe

File tree

104 files changed

+11938
-9678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+11938
-9678
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)