Changes

Jump to: navigation, search

Windows PowerShell 1.0 Pipes and Redirection

33 bytes added, 13:10, 15 May 2009
no edit summary
== PowerShell Pipes ==
Pipelines in PowerShell are essentially a sequence of commands in which the result of each command is passed through the to the subsequent command for processing. One point to note is that, unlike other shell environments, the result passed from one command to the next need not be a string, in fact it can be any type of object. Each command in a pipe is separated by the pipe character (|).
A common example of the use of pipes involves piping output from a command through to a second command which in turn formats that output. In the following example the output from the ''Get-Childitem" '' command is piped through to the ''format-table '' command:
<pre>
== Windows PowerShell Redirection Operators ==
The operators implemented by Windows PowerShell to facilitate redirection are similar to those used in other shell environments. The full complement of these operators are is outlined in the following table:
<google>ADSDAQBOX_FLOW</google>
<table border="1" cellpadding="5" cellspacing="0" id="E3B" style="border-collapse: collapse; border-color:#cccccc; border-style: solid; border-width: 1px; margin-bottom:20px">
<th>Operator</th><th>Description</th>
<tr>
<td>><td>Redirects output to specified file. If the file already exists, current contents is are overwritten.</td>
<tr bgcolor="#e9e9e6">
<td>>><td>Redirects output to specified file. If the file already exists, the new output is appended to the current content.</td>
<tr>
<td>2><td>Redirects error output to specified file. If the file already exists, current contents is are overwritten.</td>
<tr bgcolor="#e9e9e6">
<td>2>><td>Redirects error output to specified file. If the file already exists, the new output is appended to the current content.</td>
+ dir <<<< mydata.txt, myfiles.txt > output.txt 2>&1
</pre>
 
<google>BUY_WPS_BOTTOM</google>

Navigation menu