Creating a list of files using the MS-DOS prompt

Whether you use your PC for work or for pure fun, I think this article will really help you as it will allow you to perform one of those actions that the Windows operating system is unable to perform without installing additional programs.

You will surely have already had a list of files or folders that you have to show to another person who is elsewhere.

So let’s say you have a folder full of files, perhaps even very heavy ones, to be shown to a colleague of ours or a list of mp3 files with all our favorite songs to be shown to a friend of ours without, of course, having to show him. send the whole folder.

If, on the other hand, you need to send large files or folders from your pc I recommend my article that will illustrate you the best online services that perform this task easily and for free.

Otherwise you could solve the problem by creating one or more screenshots of the page to send to your colleague or friend in question but, in this case, the result obtained will be a simple image that cannot be manipulated in any way.

Then I suggest an alternative method that you will undoubtedly find better and that you will probably use periodically from now on, that is to generate a simple text file in .txt format containing the list of files in the folder of your interest using the Prompt of MS-DOS.

Do you want to know how to increase visits to your website?

Book a free appointment online now.

Launch the MS-DOS Prompt

The MS-DOS Prompt (cmd.exe) is the main command line interface of Windows systems that allows us to interface with the system itself.
Here’s how to open it:

1 solution (if you have Windows 10)

  • Type in Cortana’s search command prompt and click on the result

2 solution

  • Click on the Windows Start button
  • Click on Windows System and then on Command Promp

Here is the cmd.exe running.

Workarounds for Launching the MS-DOS Prompt

Here are further ways to launch the MS-DOS Prompt through the Run application.

Launch the Windows Run application

Here are four solutions to activate it:

1 solution (faster)

  • Press the Windows key + the R key

2 solution
(if you have Windows 10)

  • Type in Cortana’s search run and click on the result

3 solution

  • Click on the Windows Start button
  • Click on Windows System and then on Run

4 solution
(if you want to add Run to the taskbar)

  • Click on the Windows Start button
  • Click on Windows System and then right click on Run
  • Place your mouse on Other and move to the right window and click on Pin to taskbar

Here is the window you should see.

Once opened, the Run application type cmd into it and press the Enter key.

Creation of the .txt file containing the list

Below we will show you how to generate the .txt file using the cmd command line.

Now you have to go to the folder you want.

You just need to know a few basic dos commands and you are good to go.
If you were born between the 60s and 80s and as a kid you owned one of the first personal computers at home, you will certainly already be familiar with this tool.

If not, do not be scared because with two basic notions you will be able to generate your document containing the list of files.

Basics to learn

  1. Move from one hard drive to another
    For example if we want to export from disk C to disk D we will simply type:
  2. Move up or down a folder
    cd “folder name” = to access the child folder – It is not necessary to use capital letters
    cd .. = to go to the parent folder

So let’s say we have a folder called “Customer invoices” on disk D and we want to create a file that contains the entire list of file names to be submitted to our accountant.

Company names on invoices are fictional and do not correspond to real companies.

Here’s what you need to do to generate your document:

    • Click the Windows + R


  • Type cmd
  • Type D: to jump to disk d
  • type cd customer invoices to access the folder of our interest
  • type TREE / A / F & gt; filename.txt

Warning: filename is the name that the file will take and can be changed as you like depending on what you want to call that particular document.
In this case it could be called commercialist invoice and therefore the code string could be: TREE / A / F & gt; fatturecommercialista.txt

At this point close the CMD and go to the folder of your interest and you will find the .txt file

Variations for the last line of code

In place of the last line of codeTREE /A /F > nomefile.txt you can use the following lines:

dir > nomefile.txt


dir *.* > nomefile.txt

These commands allow you to view further details of the various files in the saved file such as weight and date of the last modification.

dir /W > nomefile.txt

It does not report size or creation date in the file and generates a list that includes only file and folder names

dir /S > nomefile.txt

It also reports files contained in subfolders.

dir /B > nomefile.txt

It does not report the header in the file.

You can also chain attributes; here is an example:

dir /W /S > nomefile.txt

And here is our result.

Share post

Related articles

Sign up to our newsletter

Always stay up to date


Request information

Using the form you can request information for free. A member of our staff will email you back to discuss your needs, goals, and any web-related issues you intend to solve.