(In Windows/Command line) I'd like to generate a list of all files, and for each file, I also want the full path displayed.

So if you were doing a directory listing of the folder c:\users\me and it had the files a.txt, b.txt and c.txt, I'd want the following output:

...
c:\users\me\a.txt
c:\users\me\b.txt
c:\users\me\c.txt
...

Can anyone suggest a tool that does this, or do I have to actually go code this?

link|improve this question
feedback

2 Answers

up vote 1 down vote accepted

As long as the directory doesn't have more directories in it, using the recurse option /s along with bare format /b will show the entire path with files:

dir /s /b

if there are more folders though it will display all the files in there as well. It's a neat little workaround though.

link|improve this answer
thanks!!!!!!!!!!!!!!!! that is exactly what I was looking for (I know about /s, I didn't realize /b would be useful here) thanks! – dplante Sep 25 '09 at 6:17
feedback

You can also use the for command, although it's a little more verbose:

for %x in (*) do @echo %~fx

The %~fx tells cmd to output a full path here.

forfiles also works here:

forfiles /c "cmd /c echo @path"
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.