Exporting the output to csv, xml and html in Windows Powershell

We have below commands to export the output in various formats.

  1. ConvertTo-Html : This command converts the output to HTML file format.
  2. Export-CSV : This command converts the output to CSV file format
  3. Import-CSV : This command imports the objects stored in CSV file
  4. ConvertTo-CSV : This command converts objects in to CSV strings
  5. ConvertFrom-CSV : This command converts CSV strings into Objects.

You can export the output of command in various file formats like csv, txt, xml etc.

> Get-Process | Export-csv abc.csv

You can export the output in XML file using below syntax.

> Get-Process | Export-clixml abc.xml

To convert the output in HTML, you can use below command.

> dir | ConvertTo-HTML | Out-File abc.html





You may also like...