Create a Context Menu Item to Copy a List of Files to the Clipboard in Windows 7 / Vista / XP
If you’ve ever needed to create a list of files in a directory, you’ve likely used a command from the prompt to pipe the directory listing into a file… but what if you could simply right-click on or in any folder and copy a list of the files to the clipboard? With some registry hacking and command line utilities, we can do just that… and we can even hide the menu item behind the Shift right-click menu so it doesn’t waste space unless you need to use it. Using the Menu Item You can hold down Shift and right-click inside any folder, including the Desktop, and you’ll see the new “Copy List to Clipboard” item. You can also hold down the shift key and right-click on a folder, where you’ll also see the “Copy List to Clipboard” menu item: Once you use the menu item, you should now have a list of files on the clipboard: You’ll notice it’s a simple file list, there’s no file size or any other information displayed. You could modify the registry hack to eliminate the /b switch if you wanted to get the rest of the information. How it Works We’re actually doing here is creating a menu item that opens a command prompt, runs the dir /b command (for a clean directory listing), and then pipes that into the clip.exe utility built into Windows 7 and Vista. First we browse down to the following registry key: block quote HKEY_CLASSES_ROOT\Folder\shell block quote end We created the copylist key, and then the command key underneath that. The default value for copylist is set to “Copy List to Clipboard”, and then we set the default key for command to our command line: (Updated, Thanks Todd !) block quote cmd /c dir “%1″ /b /a:-d /o:n | clip block quote end You could use the same thing from a command prompt, or in your own scripts… just replace %1 with the directory you are trying to get a listing of. 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. Create a Context Menu Item to Copy a Text File To the Clipboard in Windows 7 / Vista / XP 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: block quote HKEY_CLASSES_ROOT\txtfile\shell block quote end 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: block quote cmd /c clip < “%1″ block quote end 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. To unsubscribe send a message to accessindia-requ...@accessindia.org.in with the subject unsubscribe. To change your subscription to digest mode or make any other changes, please visit the list home page at http://accessindia.org.in/mailman/listinfo/accessindia_accessindia.org.in