Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I know you can 'find' text strings in txt files with the find and findstr commands but what i want to know is how do you find files on your computer in DOS? For example, if i wanted to do a search all my *.exe files in DOS, how would I do that?

dir/s/p *.exe
The /s searches all sub-directories, the /p gives you a pause between each screen. If you have more than one hard drive, just change to the drive you want to search. (ie; d:(enter)

That command Dan posted will search for all the files with EXE extention on the current directory and in all subdirectories under it. So, it will only search the entire drive if the current directory is the root. To search the entire drive, regardless of what is the current directory, do this:
dir/s/p \*.exe
-- or --
dir/s/p/b \*.exeThe /b switch will only display the files (with full path, because of /s), no additional lines.
Type DIR/? for more information.
-- Secret_Doom - Leonardo Pignataro --
secret_doom@hotmail.com
www.batch.hpg.com.br

Quite right Secret_Doom. I neglected to state that you should be in the root of a drive for the command to work under ALL directories. (I took it for granted as that's what I always do to search a hard drive. ie; cd\, then the command.) Thanks. Personal habit precluded a clear statement.

No problem, Dan ! =D
-- Secret_Doom - Leonardo Pignataro --
secret_doom@hotmail.com
www.batch.hpg.com.br

You will usually only want one file. (What directory is Ramdrive.Sys in, etc.) It is just DIR /S and the file name. DIR /S RAMDRIVE.SYS in this case. DIR will search the whole drive--when you start at the root--and tell you by printing to the screen the directories RAMDRIVE.SYS was in if any.

Not a suggestion on how this is best done, rather a further question based around this:
How would one pipe the contents of each of the files found to a file, appending them contiguously?
p.s. incidentally I found the attrib suggestion was very quick.

![]() |
Command differences in DO...
|
subst.exe
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |