[dos] How to list files using dos commands?

I need to list the names of the files and store it in as text file!

What I did is, I used the following dos command

 x:\xyz> dir *.* > files.txt

what this does is that, it stores the names of the files present in directory xyz as well as size, time and date of the files!

How to get only the names of files?

This question is related to dos

The answer is


If you just want to get the file names and not directory names then use :

dir /b /a-d > file.txt