Commands / Text and objects

Set-Clipboard

Copy output to the clipboard

beginner Text and objects Aliases scb

Set-Clipboard
 Get-ChildItem -Name | Set-Clipboard
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Set-Clipboard

Sends whatever comes down the pipeline to the clipboard. Paste it anywhere with Ctrl+V.

Objects are turned into text first. For a tidy table that pastes into Excel as columns, convert to tab-separated text:

Try this

Get-Process |
    Select-Object -First 10 Name, Id, CPU |
    ConvertTo-Csv -Delimiter "`t" -NoTypeInformation |
    Set-Clipboard

-Append adds to what is already on the clipboard.

Coming from another shell

ShellWhat you might type
bash / zshls | pbcopy
cmd.exedir /b | clip

More in From bash and From cmd.

Related commands