In MS Windows XP, in DOS, is it possible to do a content search(for a line or a word) in a file using command prompt.?
If so can we search a directory as well.? i.e it should search all the files in the directory for a specific word or phrase.
Thanks.
Best Answer
There are two options:
FIND
orFINDSTR
, both of which are built-in to the Windows Command Prompt.You can use
FIND
to search for a simple string in a file:You can also use it to search all files in the current directory:
FINDSTR
has a few more options: you can do searches with regular expressions, and you can search recursively into subdirectories:In all cases, these commands print each line that matches the string to be searched, along with the file they were found in.