PowerTip: Send Output to Clipboard with PowerShell

Summary: Use Windows PowerShell to easily send output to the clipboard.

Hey, Scripting Guy! Question How can I easily capture output from the Windows PowerShell console and send it to the Windows Clipboard
          so I can paste it into another program?

Hey, Scripting Guy! Answer The standard Windows utility clip.exe accepts pipeline output, for example:

Get-EventLog application -Newest 1 | clip

Comments (6)

  1. Chen V says:

    Super Cool Tip 🙂

  2. I never knew about clip.exe, thanks!

  3. Castrom says:

    Great tip! Very handy.

  4. Don Walker says:

    Great Tip! I combine this with the GridView so I can filter what I want copied to Clipboard.

    Get-EventLog Application -newest 100 | Out-GridView -PassThru | clip

    The PassThru switch allows me to select items from the GridView and send them through to the next piped command (clip).

    Of course… I could always just paste and delete everything I don’t need… but in my opinion, shift-clicking lines and an ‘OK’ to copy what I want is easier than highlighting, deleting, and repeating lines I want to exclude.

  5. Rauno Mägi says:

    clip.exe doesnt support unicode