Use clipboard in PowerShell


How to use PowerShell Clipboard


PowerShell provide a cmdlet for use the clipboard, advanced applications are allowed, from PowerShell save multible items to the clipboard to use later, it is possible to append content to already existing items in the clipboard.

The PowerShell Command Set-Clipboard copies a text to the clipboard.

The text you just copied can be retrieved with get-clipboard.

With -Append copy a text to the existing one.

This the query again with Get-Clipboard.

The following command deletes the contents on the clipboard.

And there is even more to go, if you want to retrieve files and folders that are to be copied from the clipboard, the following command gives the output.


It is also useful to copy the text content of files directly without opening the file to clipboard, such as scripts or source code.

Get-Content copies the content of test.bat to the clipboard.

Compare-Object compares the content and copies it to the clipboard.

The default of Compare-Object is not case sensitive, use the parameter -CaseSensitive to distinguish small and capital letters.

Help with examples for use can be found with Get-Help.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

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