if you want to use the dir D:\*.* /s deally and ignore certain extensions do this..
go here->
http://www.jpsoft.com
download and install 4nt
run 4nt
do the following
--- cut here
d:
except (*.txt,*.vss,*.ncb) dir *.* /s >&C:\foo.txt
--- end here
its pretty self explanatory, the *.whatever in the () are the ones to ignore
if you want to add it to an existing file do >>&c:\foo.txt
(two > instead of one )
the & means *all* output, including any errors.