I would like to receive the following output.
Suppose the directory structure on the file system is like this:
-dir1 -dir2 -file1 -fi
This is an old question, but I thought I'd add something anyhow.
DIR doesn't traverse correctly all the directory trees you want, in particular not the ones on C:. It simply gives up in places because of different protections.
ATTRIB works much better, because it finds more. (Why this difference? Why would MS make one utility work one way and another work different in this respect? Damned if I know.) In my experience the most effective way to handle this, although it's a kludge, is to get two listings:
attrib /s /d C:\ >%TEMP%\C-with-directories.txt
attrib /s C:\ >%TEMP%\C-without-directories.txt
and get the difference between them. That difference is the directories on C: (except the ones that are too well hidden). For C:, I'd usually do this running as administrator.