Found this one: http://www.watchingthenet.com/how-to-print-a-directory-tree-from-windows-explorer.html

But I don't know how do I do it and save the directory listing somewhere. What I want to do is something like that, but I need an output file. Or at least something that I can see. What I need to do is to print the contents of a directory.

link|improve this question

68% accept rate
feedback

2 Answers

up vote 2 down vote accepted
dir > dir_contents.txt
print dir_contents.txt

in short. You pipe it to the file of your choice, using dir options of your choice.

Edit:
If print doesn't work you can try this instead

start /w notepad /p dir_contents.txt

It uses notepad to print the file to your default printer.

link|improve this answer
is the print command supported out of the box these days? It does not work on my win7 – Nifle May 30 '10 at 10:46
Sorry, have no idea. Still not using them (so someone else will have to answer that one). But anyways, you can always print that file in a number of ways (including the one from explorer as mentioned in the article). – ldigas May 30 '10 at 10:54
@Nifle - that's one way for example, yes. Thanks for adding that. – ldigas May 30 '10 at 17:19
@Nifle & Idigas- Is it possible to customize it so that the output(dir_contents.txt) will only show the file name and the file type. – soul May 31 '10 at 0:40
1  
@Nrew - you mean, customize what dir outputs ? To show only the name+extension ? Yeah, sure. How about this: "dir /b /og" - will show directories at top, then the files (you just place this instead of "dir" above in the answer; nothing else changes) – ldigas May 31 '10 at 0:55
feedback

Change "%temp%\Listing" to the location and filename that you want to use.

Don't include the del line, which deletes the file created.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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