# create a list of files and folders inside of a folder via cmd and outputting it in a .txt

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?

-
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

dir/a/b/s path\to\folder > Desktop\files.txt


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

Alternatively,

tree/f > Desktop\files.txt

-
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
show 1 more comment