, , ,

Get and Set Clipboard using PowerShell

1–2 minutes
2 comments on Get and Set Clipboard using PowerShell
PowerShell Get-Clipboard

PowerShell was always a mighty tool to automate stuff, hut with the first versions we were limited in some functionally. With the release of version 3 and 4 PowerShell got even more powerful. With the latest PowerShell version 5, which is included in Windows Server 2016 and Windows 10 and also can be downloaded for older versions of Windows, Microsoft added some cool new functionality. The first things I am writing about are the Set-Clipboard and Get-Clipboard cmdlets. The cmdlets allow you to get access to the clipboard of your Windows machine.

For example, if you use CTRL + C or Copy the files from explorer:

Get-Clipboard File Explorer

You can use this cmdlet:

Get-Clipboard -Format FileDropList

PowerShell Get-Clipboard

This also works of course with other file types:

Get-Clipboard -Format Image

PowerShell Get-Clipboard Image

This is a great new addition to PowerShell!

2 responses

  1. Tim Pringle Avatar

    Nice article Thomas and great to see focus on the format options.

    I’ve found the Get-Clipboard -Format Image really handy because the returned bitmap operation also includes several overloads of Save, one of which allows you to specify filename and format. I leave it running as an event, which works great for screen capture and even copying an item into the clipboard from Paint, then writing to file.

    1. Thomas Maurer Avatar

      yep this is great :) thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.