Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use DIR to list all files in the current directory and sub directories ordered alphabetically. I only care about the filepath and name. I don't want the size, counts, etc. Here's what I have but it's just too details:

dir/on/s/w/a-d > __files.txt

This outputs something like (obfuscated):

 Volume in drive Q is ********
 Volume Serial Number is ****-****

 Directory of Q:\****

__files.txt                    __listallfileswithoutput.bat
               2 File(s)             28 bytes

 Directory of Q:\****\*

*** ****.***           ******.***              ** **** ******.***
** **** ** ******.***   
               4 File(s)  4,288,735,526 bytes

 Directory of Q:\****\*


I just want:

Q:\****\*\*** ****.***
Q:\****\*\** **** ******.***
Q:\****\*\** **** ** ******.***

Can this be done with DIR alone? If not, how can it be done?

share|improve this question
up vote 2 down vote accepted

Is the output of dir/on/s/a-d/b > __files.txt what you expect?

share|improve this answer
Yes, that's exactly what I want. You should expand your answer to include the reasons why/how it works. FYI, I looked through the DIR help and completely overlooked /b! Thanks – Paul Fleming Dec 24 '12 at 15:56
Not sure what sort of reasons/explanation you're looking for, that a simple dir /? will not provide. /on sorts by name (alphabetic), /s is for dir recursion, /a-d omits dirs and /b is for a bare output format. The rest simply redirects the command's output to your chosen file. – Karan Dec 24 '12 at 15:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.