When you want to know which files in a specific directory contain a certain text, it is sometimes easier to search with a DOS command, rather then using the Windows Search functionality. The Windows Search functionality can have trouble finding files with certain extensions, such as .php.
To search quickly from the command prompt for files containing a certain text, I often use the DOS command findstr. It is easy to use and fast.
Let's say you want to find all php files in the directory C:\htdocs\joomla that contain the text "mail". With findstr you can do that as follows:
This will give the names of all php files in C:\htdocs\joomla that contain the text "mail". If you also want to see which lines exactly contain the text, leave out the 'M'. The 'S' makes sure that you also search all subdirectories.
Tip:
Type findstr /? to see a list of all possible options you can use with the findstr command.
Wednesday, October 3, 2007
DOS Command for searching text in files on windows
findstr /MSC:"mail" *.php
No comments:
Post a Comment