Want to quickly copy the content from a text file using the right-click menu? This tutorial will show you how to copy file content to the clipboard from the context menu in Windows 10.
Generally, you have to open a text file in Notepad and then manually copy the content to paste it elsewhere. But, you can also copy content from a text or other text-based file directly from right-click menu in Windows 10. For that, you just have to carry out a Registry hack. By adding and editing some keys in Registry Editor, you can add a Copy to Clipboard option to the context menu of your text files – and then, using this option, you can copy text file content within a second.
How to copy file content to clipboard using right-click menu
In this article, I am going to show steps to copy content from text and HTML files using the context menu. You can use the same process for other file types including RTF, XML, JS CSS, etc.
1] Copy Content from a Text File using Right-click context menu
Simply follow the below steps to copy content from a text file using the context menu:
Firstly, open Registry Editor on your computer and then navigate to the following address:
Next, create a sub-key under the shell key; right-click on shell key and click on New > Key option. You can name the created key as “CopytoClip” or something similar. Now, double-click on this key and then double-click it (default) from the right panel.
You will see a dialog box where you need to set the Value Data to “Copy to Clipboard” and then press the OK button.
After that, create a new sub-key under the CopytoClip key and name it “command”. Double-click on its Default name from the right-side panel and enter the following command in its Value Data field:
cmd.exe /c type "%1" | clip.exe
Close the Registry Editor application. And now, to automate these new settings, you need to create a registry file. For that, open Notepad and enter the following data:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\copytoclip] @="Copy to Clipboard" [HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\copytoclip\command] @="cmd.exe /c type \"%1\" | clip.exe"
Make sure you enter all the details as per the name of keys and sub-keys you have created.
After entering the above text in Notepad, go to File > Save as option and while saving the file, select the Save as type to All Files. And, add the .reg extension after the filename. See the below screenshot for reference.
As you create the registry file, the option Copy to Clipboard must appear for all text files.
Just right-click on a text file, click on the Copy to Clipboard option, and then paste the file content anywhere you want.
2] Copy Content from an HTML file using Right-click menu
To add the Copy to Clipboard option for HTML files, you have to use the same steps as used for Text files. The only difference is that the HTML filetype will be located at the below address in Registry Editor:
Locate the above address and then create sub-keys and registry files as discussed in method (1) for text files.
Hope this tutorial helps you to quickly copy file content to the clipboard using the context menu.
Related: How to copy path of a file or a folder in Windows 10.