My folder structure in a drive is like this (in Windows):

Folder 1
 Fd1
 Fd2
 Fd3
 Fd4
 Fd5
Folder 2
 Fd1
 Fd2
 Fd3
 Fd4
 Fd5

This arrangement continues for 100s of folders. Inside Fd1 of each Folder x there are certain .bat files. I am looking for a way to extract a list of .bat files with entire path using Windows command line to a text file. With little experience of using command prompt I am clueless of how this can be achieved.

I want the output to be a list like this:

............
D:\Folder 1\Fd1\one.bat
D:\Folder 2\Fd2\two.bat
............

Can someone help me?

link|improve this question

feedback

1 Answer

up vote 7 down vote accepted

If I understand what you are looking for try

dir/s/b *.bat

If that works then redirect it into a text file....

dir/s/b *.bat > textfile.txt

You may also find it useful to have a list of command line switches for the DIR command.

link|improve this answer
Perhaps dir *.bat /s /b to limit output to contained .bat files? – kreemoweet Jan 17 at 22:22
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.