How to Copy a List of File Names For a Folder With the Command Prompt

The Command Prompt is one of two command-line interpreters in Windows 11. You can utilize the Command Prompt to create a simple text document that includes all the files within a specific folder. No manual copying and pasting is required for this method. This is how you can extract a list of files for a folder via the Command Prompt in Windows 11.

  1. Click Windows 11’s magnifying glass taskbar icon.
  2. Type cmd in the search tool’s box.
  3. Select Command Prompt to open its window.
  4. First, open the folder to obtain a file list within the Command Prompt. To do so, enter cd\ followed by a folder path and press Return.
  5. dir /b >filename.txt 

The text file will be generated with the name filename.txt inside the directory.