If you are the type of person that likes to keep a lot of information stored in text-format files on your drive, you’ve probably encountered a scenario where you want to copy that information to the clipboard… so you open the file in notepad, select all, then copy to the clipboard. What if you could do it with a simple context menu item instead?
Using a little registry hacking and the clip.exe utility built into Windows 7 and Vista, we can do just that, and we can even hide it behind the Shift + Right-Click menu so that it won’t waste space on the menu unless you hold down the shift key.
Using the Copy to Clipboard Hack
Simply hold down the Shift key and right-click on a text file, and you’ll see a new item for “Copy to Clipboard”:
Now you’ll have the information on the clipboard for easy pasting into whatever application you’d like:
Note: If you are using Windows XP, you can download clip.exe from Microsoft. Just save the file in the Windows directory and the rest of the hack should work for you.
Manual Registry Hack (for .txt files)
Open up regedit.exe through the start menu search or run box, and then browse down to the following key:
Underneath each file type in the registry (for instance txtfile), there is a shell key with a list of actions under it. We’ll create a new key called “copytoclip”, and then a key under it called “command”. Set the default value of “copytoclip” to something useful like “Copy Contents to Clipboard”, and then set the default value of “command” to the following:
cmd /c clip < "%1"
What we’re doing is running a command prompt, and then piping the file into the clip.exe utility. You could do the same thing from the command prompt, or in a script.
You could duplicate this same tweak for other file types, such as html or code files, by finding their key in the registry and adding the same menu items.
Downloadable Registry Hack
Simply download, extract, and double-click on CopyContentsToClipboardTXT.reg to the clipboard. You can remove the hacks with the RemoveCopyContentsToClipboard.reg file.
Just remember to hold down the shift key while right-clicking on a text file.