How to Copy a Folder’s File List with a Right-Click

acl_top

Say you have a folder full of files, and you want to save or print a list of those files. With a couple of quick Registry edits, you can add a right-click command for copying a folder’s contents to the clipboard.

If you’ve ever needed to print or save a list of files in a directory in Windows, you know that there’s no built in command for doing so. Sure, you could try capturing a screenshot of the folder and printing that, but more than likely you won’t get all the files in the shot. You may also have resorted to using a command from the prompt to pipe the directory listing into a file, which works well enough. But why not add a simple command to the context menu you get when right-clicking a folder that immediately copies a list of the files to the clipboard? Here’s how to make it happen.

Add a Right-Click Command for Copying a File List by Editing the Registry Manually

To add the right-click command in any version of Windows, you just need to make a few edits in the Windows Registry.

Standard warning: Registry Editor is a powerful tool and misusing it can render your system unstable or even inoperable. This is a pretty simple hack and as long as you stick to the instructions, you shouldn’t have any problems. That said, if you’ve never worked with it before, consider reading about how to use the Registry Editor before you get started. And definitely back up the Registry (and your computer!) before making changes.

Open the Registry Editor by hitting Start and typing “regedit.” Press Enter to open Registry Editor and give it permission to make changes to your PC.

own_1

In the Registry Editor, use the left sidebar to navigate to the following key:

HKEY_CLASSES_ROOT\Directory\shell

acl_1

Next, you’ll create a new key inside the shell key. Right-click the shell key and choose New > Key. Name the new key “copylist.” It actually doesn’t matter what you name this key; just name it something you’ll recognize.

acl_2

Now, you’ll change the (Default) value inside the new copylist key. With the copylist key selected, double-click the (Default) value to open its properties window.

acl_3

In the properties window, set the value in the “Value data” box to “Copy File List to Clipboard” and then click “OK.” This value gives the command the name that will appear on the context menu. Again, you can type any text you want. We just recommend making it something brief and descriptive.

acl_4

Next, you’ll create a new key inside your copylist key. Right-click the copylist key and choose New > Key. Name the new key “command.”

acl_5

Now, you’ll change the (Default) value inside the new command key. With the command key selected, double-click the  (Default)  value to open its properties window.

acl_6

The (Default) value specifies the actual command that will run when you select the option on the context menu. To add a command for copying a simple list of all file names to the clipboard, type the following text into the “Value data” box and then click “OK.”

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

acl_7

Alternatively, if you want to copy a list with more details than just the file name, you could remove the /b switch from that command. This will copy the name, date, and size of files as well. Just put the following text into the “Value data” box instead:

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

acl_8

Since we’re calling the command prompt dir command, you could also use any of the switches that command supports if you prefer. Check out the Microsoft documentation for the dir command for more information, or just type dir /? at a Command Prompt.

Whichever command you chose, the changes should take place immediately, so you can exit out of Registry Editor. To test it out, just right-click any folder and select the “Copy File List to Clipboard” command. You might see a brief flash of the Command Prompt window opening and closing. You can paste the contents of the clipboard into the app of your choosing.

If you chose the command with the /b switch, you’ll see a simple list of files.

acl_9

If you chose the command without the /b switch, you’ll see more details.

acl_10

If you want to reverse the changes at any time, just go back into the Registry and delete the copylist key that you created. This will automatically delete any values and other keys you created inside the copylist key and remove the command from your context menu.

Download Our One-Click Registry Hacks

acl_11

If you don’t feel like diving into the Registry yourself, we’ve created some registry hacks you can use. The “Copy Simple File Names to Clipboard” hack adds the command for copying just file names to the context menu. The “Copy File Names and Details to Clipboard” adds the command for copying file names, dates, and sizes to the context menu. And the “Remove Copy File Commands from Context Menu (Default)” removes the command no matter which one you added. All three hacks are included in the following ZIP file. Double-click the one you want to use and click through the prompts.

Copy File List Hacks

These hacks are really just the copylist key, stripped down to the additional keys and values we talked about in the previous section and then exported to a .REG file. Running the hacks just modifies the value. And if you enjoy fiddling with the Registry, it’s worth taking the time to learn how to make your own Registry hacks.

Walter Glenn is a long time computer geek and tech writer. Though he's mostly a Windows and gadget guy, he has a fondness for anything tech. You can follow him on Facebook and Twitter.

  • Published 01/6/17
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!