Personalization Add "Copy Contents to Clipboard" Context Menu in Windows 11


  • Staff
Clipboard3_banner.png

This tutorial will show you how to add or remove the Copy Contents to Clipboard context menu of text type files for all users in Windows 10 and Windows 11.

The Copy Contents to Clipboard context menu item will allow users to copy the contents of a single .bat, .cmd, .css, .html, .js, .log, .ps1, .reg, .rtf, .txt, or .vbs file to the clipboard to make it easy to paste the contents where you like.


While you must be signed in as an administrator to add or remove the context menu, all users can use the context menu.



EXAMPLE: "Copy Contents to Clipboard" context menu

In Windows 11, you will need to click/tap on Show more options first by default, then click/tap on Copy Contents to Clipboard.


Show_more_options.png
Copy_Contents_to_Clipboard_context_menu.png



Here's How:

1 Do step 2 (add) or step 3 (remove) below for what you would like to do.

2 Add "Copy Contents to Clipboard" to context menu

A) Click/tap on the Download button below to download the file below, and go to step 4 below.​

Add_Copy_Contents_to_Clipboard_context_menu.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

;For BAT files
[HKEY_CLASSES_ROOT\batfile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\batfile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""


;For CMD files
[HKEY_CLASSES_ROOT\cmdfile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\cmdfile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""


;For CSS files
[HKEY_CLASSES_ROOT\SystemFileAssociations\.css]
"PerceivedType"="document"

[HKEY_CLASSES_ROOT\SystemFileAssociations\.css\shell\Copy Contents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\SystemFileAssociations\.css\shell\Copy Contents\command]
@="cmd /c clip < \"%1\""


;For HTML files
[HKEY_CLASSES_ROOT\htmlfile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\htmlfile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""

[HKEY_CLASSES_ROOT\SystemFileAssociations\.html\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\SystemFileAssociations\.html\shell\CopyContents\command]
@="cmd /c clip < \"%1\""


;For JS files
[HKEY_CLASSES_ROOT\JSFile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\JSFile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""


;For PS1 files
[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\shell\CopyContents\command]
@="cmd /c clip < \"%1\""


;For REG files
[HKEY_CLASSES_ROOT\regfile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\regfile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""


;For RTF files (Will not work for .rtf files if "Office Word" is the default app instead of "Wordpad")
[HKEY_CLASSES_ROOT\rtffile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\rtffile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""


;For TXT and LOG files
[HKEY_CLASSES_ROOT\SystemFileAssociations\.txt\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\SystemFileAssociations\.txt\shell\CopyContents\command]
@="cmd /c clip < \"%1\""

[HKEY_CLASSES_ROOT\textfile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\textfile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""

[HKEY_CLASSES_ROOT\txtfile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\txtfile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""

[HKEY_CLASSES_ROOT\txtfilelegacy\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\txtfilelegacy\shell\CopyContents\command]
@="cmd /c clip < \"%1\""


;For VBS files
[HKEY_CLASSES_ROOT\VBSFile\shell\CopyContents]
"Extended"=-
"Icon"="DxpTaskSync.dll,-52"
"MUIVerb"="Copy Contents to Clipboard"

[HKEY_CLASSES_ROOT\VBSFile\shell\CopyContents\command]
@="cmd /c clip < \"%1\""

3 Remove "Copy Contents to Clipboard" from context menu

This is the default setting.


A) Click/tap on the Download button below to download the file below, and go to step 4 below.​

Remove_Copy_Contents_to_Clipboard_context_menu.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

[-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]

4 Save the .reg file to your desktop.

5 Double click/tap on the downloaded .reg file to merge it.

6 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.

7 You can now delete the downloaded .reg file if you like.


That's it,
Shawn Brink


 

Attachments

  • Clipboard3.png
    Clipboard3.png
    8.6 KB · Views: 81
  • Add_Copy_Contents_to_Clipboard_context_menu.reg
    7.4 KB · Views: 229
  • Remove_Copy_Contents_to_Clipboard_context_menu.reg
    1.9 KB · Views: 214
Last edited:
I've been using this for quite a while on Windows 10 and it's very helpful. But I've recently noticed that it does not include all text file trypes. Some of the file types that I frequently encounter include .ahk (AutoHotKey), .py (Python), .bak (backup file from an edit), .ini and .xml. There are many other text file types, including numerous programming languages that I'm not currently using (but may in the future).

I was about to add registry entries for these missing file types, but I realized that it would be a monumental task to add them all, especially for those types that I'm not using yet (but might some day). I searched the registry to see how notepad++ handled the problem and found HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Open with Notepad which adds "Open with Notepad" to the context menu for all file types. So I wrote a .reg file that adds a "Copy Contents to Clipboard" command to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell.

Code:
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"

The only disadvantage I've found so far is that it adds "Copy contents to clipboard" for all files, including those for which that's not really appropriate, such as .exe files. However, you can just ignore the option for those files. It doesn't seem to hurt anything having it there.

Any suggestions or comments will be appreciated.
 

My Computer

System One

  • OS
    Win 10 pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    several (Dell, HP, custom build, Lenovo, ASUS, etc.)
    CPU
    several
    Motherboard
    several
    Browser
    Firefox
    Other Info
    I have many computers, mostly Dell and HP.
Back
Top Bottom