Skip to content

Instantly share code, notes, and snippets.

@micycle1
Created April 13, 2025 15:04
Show Gist options
  • Save micycle1/81a31ad8d7055f4ffba3ca0a24554049 to your computer and use it in GitHub Desktop.
Save micycle1/81a31ad8d7055f4ffba3ca0a24554049 to your computer and use it in GitHub Desktop.
Adds a 'Copy Contents to Clipboard' context menu item to allow users to copy the contents of files to the clipboard to make it easy to paste the contents where you like.
Windows Registry Editor Version 5.00
; Step 1: Remove type-specific keys added by the old version of this script
[-HKEY_CLASSES_ROOT\batfile\shell\CopyContents]
[-HKEY_CLASSES_ROOT\cmdfile\shell\CopyContents]
[-HKEY_CLASSES_ROOT\SystemFileAssociations\.css]
[-HKEY_CLASSES_ROOT\htmlfile\shell\CopyContents]
[-HKEY_CLASSES_ROOT\SystemFileAssociations\.html\shell\CopyContents]
[-HKEY_CLASSES_ROOT\JSFile\shell\CopyContents]
[-HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\CopyContents]
[-HKEY_CLASSES_ROOT\regfile\shell\CopyContents]
[-HKEY_CLASSES_ROOT\rtffile\shell\CopyContents]
[-HKEY_CLASSES_ROOT\SystemFileAssociations\.txt\shell\CopyContents]
[-HKEY_CLASSES_ROOT\textfile\shell\CopyContents]
[-HKEY_CLASSES_ROOT\txtfile\shell\CopyContents]
[-HKEY_CLASSES_ROOT\txtfilelegacy\shell\CopyContents]
[-HKEY_CLASSES_ROOT\VBSFile\shell\CopyContents]
; Step 2: Add context menu item for all files
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CopyContents]
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CopyContents\command]
@="cmd /c clip <\"%1\""
; Step 3: This was in the original type-specific code. Is it important?
;For CSS files
[HKEY_CLASSES_ROOT\SystemFileAssociations\.css]
"PerceivedType"="document"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment