Powershell - Playing with the Windows clipboard

To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!

A new article on how to send and retrieve information from the Windows clipboard.
I use these commands in certain functions that allow me to reformat copied text and then paste it back into the expected format.

# Set clipboard content
Set-Clipboard -Value 'Hi'
# or via the pipeline
'Hello' | Set-Clipboard
# Add content to clipboard
'Hello' | Set-Clipboard -Append
# Display clipboard content
Get-Clipboard
# Display content in a single string value
Get-Clipboard -Raw
#
(Get-Clipboard).count
(Get-Clipboard -Raw).count
# Copy a folder
Set-Clipboard -Path D:\Sessions
# Display information about the copied folder
Get-Clipboard -format FileDropList
# Copy files
Set-Clipboard -Path D:\Sessions\*
Get-Clipboard -format FileDropList
# Display information about a copied image
Get-Clipboard -format image
# Example of use
# Turning the clipboard contents into a miniscule
(Get-Clipboard).ToLower() | Set-Clipboard

Related links