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:
  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)
  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

@="Copy to Clipboard"

@="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. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded in 2005.

1 thought on “Copy Text file Contents to Clipboard via Right-Click Menu”

  1. Is there any way of doing this the other way around and creating a text file using the contents of the clipboard?

    So Copy Clipboard Contents to a Text File Using the Context Menu?


Leave a Comment