Windows Tip: How To Copy A Folder’s File List From Context Menu

To get a list of files in a folder, you can use File Explorer to navigate to that folder, but Windows doesn’t have an option out of the box to create a list of the file names in that folder. Here is a pretty cool tip that adds an option in the Context Menu that lets you copy that list in any given folder right there.

First of all, we will need to reveal the command line used to list the file names in a folder. And you guessed it right. It’s the old school DIR if you still remember.

dir /b /a /o:n | clip

Once executed, a list of file names in the current folder, including folders, will be copied to the clipboard for further uses.

If you only need all the files in the current folder listed, you can use the following command instead.

dir /b /a:-d /o:n | clip

The “/o:n” in the command ensures the list from the folder is automatically sorted by names.

Now let’s get the Copy File List option to the right-click context menu.

Open Registry Editor and navigate to the following location:


Create a new Key called “Copy File List,” just any name you want to be shown in the context menu.

Then create another new Key called “command” under the new key “Copy File List” and set the following string as the Default value.

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

All set, now let’s test it out.

Right-click any folder you want to get a list of the files, and simply choose Copy File List.

Bonus tip #1:

If you don’t want to go through the hassle creating the option in the context menu, you can still archive the same by navigating to the folder in File Explorer and run the following command in the address bar. The same list will be copied to the clipboard for you right after.

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

Bonus tip #2:

Thanks to our friend, Glenn Reimche, who shared an even better tip in the comments area below that lets you copy the file list while you are inside the folder in File Explorer.

Basically, go to the following registry location:


Create a new Key called “Copy File List,” or whatever the name you like to see from the context menu.

And another new Key called “command” under “Copy File List,” and set the following string as the Default value.

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

Now, let’s navigate to a folder you want to copy the list of file names in it, right-click the empty space in that folder and choose “Copy File List.”.

Kent Chen

Microsoft MVP, IT Professional, Developer, Geek, and the co-founder of Next of Windows.

Last updated: 02/06/2017

Posted in: Tips & Tricks
Discover more: