Example content

$c = Get-Command

Visualize

Split output into console-sized pages

$c | more

Launch table GUI

$c | Out-GridView

Show plaintext table

$c | Format-Table

Empty file

Set 0 KB or create empty file

Out-File -FilePath $file
  • abbreviate Out-File $file

File export

Export lossless .NET object

$c | Export-Clixml -Path "object.xml"

Export spreadsheet table separated by commas for programs like Excel.

$c | Export-Csv -Delimiter "," -NoTypeInformation -Path ".\text.csv"

Export plaintext table separated by spaces.

$c | Format-Table -AutoSize -Wrap |
	Out-File -FilePath ".\text.txt"

Export plaintext list with each property on a new line.

$c | Format-List |
	Out-File -FilePath ".\text.txt"

Export encrypted standard string

$c | ConvertTo-SecureString -AsPlainText -Force |
	ConvertFrom-SecureString |
	Out-File -FilePath ".\key.bin"

Sources:

Related:

Tags:
PowerShell Objects - Handle, Import, Export, Filter and RegEx query objects
Document conversion