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

Found this one:

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.

share|improve this question
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.

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.

share|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). – Rook May 30 '10 at 10:54
@Nifle - that's one way for example, yes. Thanks for adding that. – Rook 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
@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) – Rook May 31 '10 at 0:55

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

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

share|improve this answer go to this link and it will show you exactly how to do it I used this in Win 7 and it works.

share|improve this answer

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.