How-To Geek

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:



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

cmd /c dir "%1" /b /a:-d /o:n | clip

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.

Downloadable Registry Hack

Naturally, I wouldn’t make you go through all the trouble of adding those keys manually, so you can download, extract, and double-click on the CopyFileListClipboard.reg file to install. There’s also a remove script included.

Just remember: you have to hold down the shift key while right-clicking in order to see the menu.

Download CopyFileListClipboard Registry Hack

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 06/13/08

Comments (28)

  1. Higham

    Thank you. This is all the option I have wanted.

  2. Todd Corson

    I’m running XP SP2 and I found that clip.exe is installed on my machine, so this tip appears to work for XP users as well. To find out if your install has clip.exe, just fire up a command prompt and type “clip”, then press [Enter]. If you get a response that says ‘INFO: Type “CLIP /?” for usage’, then you’re in good shape.

    Note that the behavior of the context menu is a little different in XP. First of all, you have to click on a folder to get the option – it won’t show up if you click inside a folder. Secondly, the option will always appear in the context menu whether you press [Shift] or not.

    I also have a few suggestions for other options to use in the command itself. With the /b option enabled, you can’t really tell the difference between a file name and a folder name, though usually (but not always) the files have extensions and the folders don’t. However, since the point of the tweak is to get a list of files, you may want to include the /a:-d option to exclude directories from the list. Also, I find that the dir command puts the files in whatever order it wants unless you tell it otherwise, so sorting by name with the /o:n option isn’t a bad idea either.

    With those two options included, my final command looks like this:

    cmd /c dir “%1” /b /a:-d /o:n | clip

    Thanks for the tip, and keep ’em coming!

  3. beep54

    Re: ‘Create a Context Menu Item to Copy a List of Files to the Clipboard in Windows Vista’

    Is there a way to do this in XP?

  4. The Geek


    That’s a very good point.. I should change the command.

    I tested on XP SP2 and did not have clip.exe… I need to figure out what’s up with that.

  5. beep54

    I found a copy of clip.exe at this location

    I opened the zip into my WINDOWS folder and it seem to work as per Todd Carson above.

  6. Rupertsland

    This trick does NOT work in Windows XP SP3. I tried following the instructions and installed the CLIP executable to the C:\Windows folder, but nothing works. It’s a no go.

  7. Leonard Lee

    This works on Windows XP SP3. I had verified it.

    By the way, I did notice that it can only list one level of folder’s files.

    Can we also make it to iterate all the directories contain within the specified folder? E.g. List all files and folders.

    Thanks in advance.

  8. The Geek


    If you add a /s switch to the dir command you could display all files… note that it would probably be slow depending on where you run it from.

  9. Leonard Lee

    Cool! Thanks for the advice.

    We do understand the consequences of executing this command at the root directory. This process would take quite a long time.

    Anyway, I did make adjustment to the registry shown as below.

    cmd /c dir “%1” /s /b /a:-d /o:n | clip

    It works too. Listing everything contain in the folder and its sub folders.

  10. Dave Kong

    This is great, but it doesn’t list folders. I need to get a folder list copied to the clipboard.

  11. Todd Corson


    If you want to list only folders, change the /a:-d option to /a:d. The d means to list directories, while -d means not to list directories. Use the /s option if you want to traverse the folders below the one you’re right-clicking on and get a list of the whole tree from that folder down.

    Good luck!


  12. Todd Corson

    Just as a tip to everyone, the “dir” function has loads of command-line switches that we haven’t even gotten into in this discussion.

    If you’re interested in tweaking the context menu item in ways that haven’t been mentioned, go to a command prompt and type “dir /?”. You’ll get a nice list of all the features that are available. You’ll probably want to experiment at the command prompt until you get the results you’re looking for, and then you can make the changes in the registry (if you leave the “| clip” off the end, you can see the results in the cmd.exe window instead of having to paste them somewhere else).

    As The Geek mentioned, using the /s switch can take a long time if you’re starting from high up in the tree… but it can be handy if you don’t mind waiting.

    Have fun tweaking the tweak!

    Todd Corson

  13. Rupertsland

    Hello again,

    This is all frustrating for me. I still can’t get this wonderful solution to work in Windows XP SP3. Nothing happens. It just doesn’t execute, and I still can’t figure out why. I downloaded the CLIP.EXE file from Microsoft and placed the file in C:\Windows\. I went into RegEdit and followed the instructions exactly. It fails to work.

    Geek’s solution is an excellent one. I really want to use it. What could be preventing CLIP.EXE from running on Windows XP?

  14. Leonard Lee


    Did you hold down the shift key while right-clicking in order to see the ‘hidden’ menu?

  15. Rupertsland

    I feel pretty embarrassed.

    I finally got it working. After attempting to edit the registry manually, I decided to simply download the registry hack file and see what happens. Well, everything worked. I noticed an extra Extended key appearing under copylist that I didn’t know that had to be there. At least, that’s what I am thinking.

    Anyway, now I can tweak the command further.

    Please excuse my earlier whining. Thank you Geek for this great solution.

  16. The Geek


    The Extended key makes the item appear only on the shift/right-click menu… I forgot to mention it in the post.

    Registry editing can be tricky, that’s why I always provide the download files :-)

  17. Leonard Lee


    Glad that it can help you.

  18. GlendaBarron


  19. Simon

    Thanks for the tip! Very useful indeed, and also opens up other possibilities with the use of displaying entries with extended key (for hiding less used context menu hacks).

    The dir arguments are numerous. I would suggest that for alternative versions you could rename the context menu entry and have multiple choices :-) E.g Copy List…. and Copy List inc Subdirs… etc.

    Anyhow, thanks.

  20. Wayne L Pendley

    The How-To Geek is a god!

  21. Nas

    I have been doing this for a while – kind of a cut-down google of my folders and files ….. so excellent tip and writeup.

    I have one question:

    Is it possible to exclude a specific file and/order folder from the listing? I can’t see a specific switch for this in the dir command (the /a:-d option to exclude directories is not the same).

    An example:

    \Folder A
    \Folder A\File 1
    \Folder A\File 2
    \Folder B
    \Folder B\File 1
    \Folder B\File 2
    \Folder C
    \Folder C\File 1
    \Folder C\File 2
    \ and so on

    I want to exclude all folders/files in Folder B (i.e list all other files and folders)


  22. Pennie

    I d/l your registry file, extracted and ran it but it isn’t working on my Vista laptop. Any help would be greatly appreciated. TIA

  23. denis

    Simply BRILLIANT!!! thank you so much, man

  24. jim

    Same questions as Pennie, I have a Vista laptop and holding the shift right click is not working for me either. I have downloaded, extracted, and ran the file. Any other steps I am overlooking?

  25. Stev

    Tried on Windows seven but doesn’t work : Command promts shortly but nothing is past to clipboard … Any idea ?
    Command seems to display some messages but it closes itself to fast so I can’t read anything :(

  26. Stev

    @Nas …
    I know you posted 2 years ago lol, but in case someone is interested to get the trick …
    I know that the “tree” command lists all directories and files ordered the way you discribed, options are available as well.

  27. iphoness

    Thanks for the review.
    it’s very interesting and full of handy features..

  28. thanks

    really awesome thanks

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!