How to search file name using dos in windows

How do you find files in dos in windows, basically I want to create a batch file which finds files with specific name and creates an another text file with all of those files. For example, if I have 100 files in C:\test and only 5 files contains abcd or pqrs in the filename, it should print only those files and nothing else.

Prompt response will be highly appreciated.


Who is Participating?
ghostdog74Connect With a Mentor Commented:
you can try dir /S | findstr "your search string"
dir *abcd*.*
dir *pqrs*.*

...unfortunately dir is only able to look for one thing at a time (that is, if you want to find something you need "OR-logic", you need to find them in separate runs.
@ghostdog74: Much better than my approach. Must admit that that ("findstr") was entirely new command for me (though it must be said that I hardly ever use Windows' command line any more). Too bad that /S doesn't keep the directory name with the filename - otherwise that'd be really usefull...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.