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

In order for me to get the results of a file search in a readable format, I use the following command line in a command prompt:

dir *.* /s > myResultList.txt

I then open that list in Excel, use fixed width format to get rid of all the stuff I don't want and then I have my list.

Seems like a lot to do for something so simple.

Does anyone out there have any recommendations for something that would work better than this?

share|improve this question

migrated from May 13 '10 at 9:59

This question came from our site for professional and enthusiast programmers.

Question will be better phrased by including the information you DO want to extract from the DIR results. – Shevek May 13 '10 at 10:19
up vote 1 down vote accepted

It's a little hard to understand what exactly you're aiming for, but you can get a plain list of files by including the /b switch to dir:

dir /s /b *>foo.txt

If you have requirements for the exact format of the output, then perhaps a for loop might be more appropriate:

(for /r %x in (*) do (@echo."%x";%~tx;%~zx))>foo.csv

This would output a CSV file with the file names, their modification date and time and the file size, which you can easily open in Excel.

If you want a fixed-width format of custom columns—that's ... a little much more complex and I won't provide that here.

share|improve this answer

Using 'Powershell' and the 'Powershell Community Extensions' you will get access to the get-clipboard and out-clipboard commands, which can be used as explained here.

Another candidate: 'nircmd.exe' with the clipboard subcommand. Finally, try 'clip.exe' to pipe output to the clipboard on the command line.


Since Vista, there seems to be a clip.exe in C:\Windows\system32.

share|improve this answer

find allows you to specify various criteria for searching for files, and lets you generate output using various formatting options.

share|improve this answer
i think his real problem is not the search/find but how to transfer the result of (basically any commandline operation) into excel/word etc. – akira May 13 '10 at 10:10

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.