Copy Text file Contents to Clipboard via Right-Click Menu

To copy the contents of a text-based file, you open the file in an editor such as Notepad, use Select All and then copy the contents to the clipboard. How about accomplishing it using a command in the right-click menu?

Add “Copy to Clipboard” to the Context Menu

  1. Start the Registry Editor (regedit.exe)
  2. Go to the following branch:
    HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell
  3. Create a subkey named “Clipboard
  4. Double-click (default) and set “Copy to Clipboard” as its data.
  5. Under “Clipboard”, create another subkey named “command
  6. With the “command” key selected, double-click (default)
    HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\Clipboard\command
  7. Set the (default) value data to:
    cmd.exe /c type "%1" | clip.exe
  8. Exit the Registry Editor.

Registry File

To automate the above setting, use this .reg file. Using Notepad, you can create a .reg file with the following contents.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\clipboard]
@="Copy to Clipboard"

[HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\clipboard\command]
@="cmd.exe /c type \"%1\" | clip.exe"

Double-click the registry file to apply the settings to the registry.

The “Copy to Clipboard option appears for most of the text-based files (i.e., file types whose PerceivedType registry value is set to “text“) listed below:

.asm, .asmx, .aspx, .c, .cdxml, .cpp, .css, .csv, .cxx, .def, .diz, .h, .hpp, .hta, .htm, .html, .hxx, .inc, .ini, .java, .nvr, .php3, .pl, .plg, .ps1xml, .pssc, .sed, .shtml, .sql, .text, .tsv, .txt, .xml, .xsl

Now, right-click on a text file and choose Copy to Clipboard.



This copies the text file contents to the clipboard. To verify that, you may open Notepad or any other text editor and press Ctrl +V to paste the contents from the clipboard.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time.

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a ten-time recipient of the Microsoft MVP award in Windows Desktop Experience (Windows Shell), from 2003 to 2012. Ramesh founded Winhelponline.com in 2005.

Leave a Comment