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 need to create a list of files that is in a certain folder, and then outputting it in a .txt file and put it on my desktop. Is this possible with CMD and if so, how can I do this?

Windows 7 Home premium 64bit

share|improve this question
Powershell is not an option for you? – squillman Mar 25 '11 at 18:38
I never used Powershell before. – kb67 Mar 25 '11 at 18:40
up vote 5 down vote accepted
dir/a/b/s path\to\folder > Desktop\files.txt

(Remove /a if you don't want to list "hidden" files.)


tree/f > Desktop\files.txt
share|improve this answer
Thank you. tree/f is a shortcut to it? – kb67 Mar 25 '11 at 18:47
@kb67: No, tree is a different program - it lists files in a pseudo-graphical tree view. (tree lists only directories, tree/f includes files.) – grawity Mar 25 '11 at 18:49
Which one would you prefer? :) – kb67 Mar 25 '11 at 18:50
@kb67: It depends on which format you want the list to be. Just run tree and dir/a/b/s and compare. – grawity Mar 25 '11 at 18:51
How do I specify the directory with tree – kb67 Mar 25 '11 at 18:55

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.