Pipeline
The output of the previous command as the input to the next command.
PowerShell Pipeline
For example, get all the file information for the current directory through LS, and then by sort-descending the file information in descending order of name, and finally format the name and mode of the sorted file as table output.
PS c:\pstest> ls | Sort-descending Name | Format-table name,mode
Name Mode
---- ----
d.txt-a---c.txt-a ---
b.txt -A ---
ABC d----
a.txt-a ---
redirect
Save the output of the command to the file, ' > ' for Overwrite, ' >> ' append.
PS c:\pstest> "Powershell Routing" >test.txt
PS c:\pstest> get-content. \test.txt Powershell routing<
C3/>ps c:\pstest> "Powershell Routing" >>test.txt
PS c:\pstest> "Powershell Routing" >>test.txt< C5/>ps c:\pstest> "Powershell Routing" >>test.txt
PS c:\pstest> "Powershell Routing" >>test.txt< C7/>ps c:\pstest> "Powershell Routing" >>test.txt PS c:pstest\> get-content. \test.txt Powershell
Routing
Powershell Routing
Powershell Routing
Powershell Routing Powershell Routing Powershell Routing
PS c:\pstest>