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.

RELATED: How to Screenshot on Windows 10

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.

RELATED: Learning to Use the Registry Editor Like a Pro

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.

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


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.

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.

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.

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.”

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.

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

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

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.

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

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

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

RELATED: How to Make Your Own Windows Registry 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.

Profile Photo for Walter Glenn Walter Glenn
Walter Glenn is a former Editorial Director for How-To Geek and its sister sites. He has more than 30 years of experience in the computer industry and over 20 years as a technical writer and editor. He's written hundreds of articles for How-To Geek and edited thousands. He's authored or co-authored over 30 computer-related books in more than a dozen languages for publishers like Microsoft Press, O'Reilly, and Osborne/McGraw-Hill. He's also written hundreds of white papers, articles, user manuals, and courseware over the years.
Read Full Bio »