Fist of Tech

Use PowerShell via context menu to remove double entries from your clipboard

This is a small example for handy use of PowerShell. In this post, I will show you how to clean up your clipboard from double entries by using PowerShell. We will also add it to the context menu for easy access.

To clean up the clipboard we will use Get-Clipboard to fetch it and use Select-Object to clean it up. This can be further extended to save the clipboard content to a file with Out-File or Append-Content. In this example I will use the following line:

Get-Clipboard | Select-Object -Unique | Set-Clipboard

To add the command to the registry you can import the following file in a β€œ.reg” file. It will update your context menu immediately.

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\Clean Clipboard]
@="&Clean Clipboard"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Clean Clipboard\command]
@="powershell.exe -windowstyle hidden -command Get-Clipboard | Select-Object -Unique | Set-Clipboard"

After that you can fire off the command from your context menu πŸ™‚

The secret to living well is: eat half, walk double, laugh triple and copy once

Zen Master Xiakit
Exit mobile version