06.The pipeline
Connecting one command to another
Exporting to a file
Exporting to CSV
Get-Process | Export-CSV process.csv
Import-CSV process.csv
Exporting to JSON
Exporting to XML
Out-File
We have talked about CSV, JSON, and XML files, but what if you simply want a flat file to store your data in? Let’s look at the Out-File
command. It takes the data that is in the pipeline and directs it out to a flat file—below a text file in our example:
ps
Get-ChildItem | Select-Object Name | Out-File process.txt
This series of piped commands can be useful when creating a cover page for listing all article titles in a certain folder.