How to Generate a List of Filenames in a Directory on Windows
Occasionally, you might want to print or save a list of the files in a folder.
While Windows 11 doesn’t offer a built-in feature for this through its graphical interface, there are several easy ways to accomplish it—whether you want a quick inventory, a printable list, or a saved record for work or backup purposes.
In this guide, I’ll walk you through three methods:
- Using PowerShell or Command Prompt
- Adding a right-click context menu option via the Registry
- Using downloadable registry hacks for one-click setup
Method 1: Use PowerShell or Command Prompt
This is the simplest and most flexible way to generate a file list.
Step-by-Step Instructions
- Open PowerShell or Command Prompt:
- Navigate to the folder you want to list.
- Right-click inside the folder and select “Open in Terminal” or “Open PowerShell window here.”
- Run the following command:
dir > filename.txt
- This creates a file named filename.txt in the same folder, containing a full directory listing.
- Prefer a cleaner list with just filenames? Use this instead:
cmd /r dir /b > filename.txt
- or in Command Prompt:
dir /b > filename.txt
- The /b switch outputs only the filenames, one per line.
Method 2: Add a Right-Click Option to Copy File List
If you frequently need file lists, you can add a custom command to your right-click context menu.
Warning: Editing the Windows Registry can be risky. Always back up your registry and system before making changes.
Add the Context Menu Option
- Press Win + R, type regedit, and press Enter then navigate to:
HKEY_CLASSES_ROOT\Directory\shell
- Right-click the shell key → New > Key → name it copylist.
- Select the new copylist key and double-click the (Default) value.
- Set it to: Copy File List to Clipboard
- Right-click copylist → New > Key → name it command.
- Select the command key and double-click the (Default) value.
- For a simple list of filenames:
cmd /c dir “%1” /b /a:-d /o:n | clip
- For a detailed list (name, size, date):
cmd /c dir “%1” /a:-d /o:n | clip
- Close Registry Editor.
Now, right-click any folder and select “Copy File List to Clipboard.” Paste it into Notepad, Excel, or anywhere else.
Method 3: Use One-Click Registry Hacks
If you’d rather not edit the Registry manually, you can use pre-made .reg files:
- Copy Simple File Names to Clipboard
- Copy File Names and Details to Clipboard
- Remove Copy File Commands from Context Menu
These files automate the registry changes described above. Just double-click the one you want and follow the prompts.
Tip: You can create your own .reg files by exporting the modified keys from Registry Editor.
Conclusion
Whether you’re organizing files, documenting software, or just curious about what’s in a folder, generating a list of filenames in Windows 11 is easier than it seems.
This article provided you with quick PowerShell commands to a custom right-click options, giving you multiple tools at your disposal.
I welcome your thoughts, questions or suggestions on my article on how to generate a list of directory filenames on Windows.
You may support my work by sending me a tip using your Brave browser or by sending me a one time donation using your credit card.
Let me know if you found any errors within my article or if I may further assist you by answering any additional questions you may have.




