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


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 If you have Smart App Control turned on, you will need to unblock the downloaded REG file.

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

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

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


That's it,
Shawn Brink


 

Attachments

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 My Computer

At a glance

Win 10 proseveral
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.
SpacemanSam's version seems to work. I suppose a set of Undo lines would be ideal.

Note also the option of adding context menu entries for copying simple or detailed file lists from folders:

Windows Registry Editor Version 5.00

; modified from Walter Glenn (How-To Geek): http://www.howtogeek.com/287584/how...copying-a-folders-file-list-to-the-clipboard/

[HKEY_CLASSES_ROOT\Directory\shell\copylists]
@="Copy file list - simple"
[HKEY_CLASSES_ROOT\Directory\shell\copylists\command]
@="cmd /c dir \"%1\" /b /a:-d /o:n | clip"

[HKEY_CLASSES_ROOT\Directory\shell\copylistd]
@="Copy file list - detailed"
[HKEY_CLASSES_ROOT\Directory\shell\copylistd\command]
@="cmd /c dir \"%1\" /a:-d /o:n | clip"

; Undo
; [-HKEY_CLASSES_ROOT\Directory\shell\copylists]
; [-HKEY_CLASSES_ROOT\Directory\shell\copylistd]
 
Last edited:

My Computer My Computer

At a glance

Windows 11 24H2 26100.3476Intel Core i5-13500G.Skill DDR4 32GB F4-3200C16-32GVKIntel UHD Graphics 770
OS
Windows 11 24H2 26100.3476
Computer type
PC/Desktop
Manufacturer/Model
Various homebuilt
CPU
Intel Core i5-13500
Motherboard
ASUS PRIME H770-PLUS D4
Memory
G.Skill DDR4 32GB F4-3200C16-32GVK
Graphics Card(s)
Intel UHD Graphics 770
PSU
Corsair RM750e ATX
Cooling
DeepCool AK500 Zero Dark
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.
Thank you so much..it's working as of today 😍
 

My Computer My Computer

At a glance

Windows 1111th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GH...16.0 GB DDR4 (15.7 GB usable)Intel(R) Iris(R) Xe Graphics + NVIDIA GeForce...
OS
Windows 11
Computer type
Laptop
Manufacturer/Model
HP
CPU
11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (2.42 GH
Memory
16.0 GB DDR4 (15.7 GB usable)
Graphics Card(s)
Intel(R) Iris(R) Xe Graphics + NVIDIA GeForce MX450 GDDR5 (2048 MB)
Screen Resolution
1920 x 1080
Hard Drives
SAMSUNG : 512.1 GB
Mouse
Logitech M4590
Internet Speed
100 MBps
Browser
Microsoft Edge
Antivirus
Norton 360
Other Info
Meoww 😻
Back
Top Bottom