Finding Text in Multiple Files
Home Page (Text Editor) | Overview | How Do I ... Topics | FAQ | Reference
The Find in Files command supports two output panes. This allows you to conduct a second search through multiple files without losing the results from your first search.
To find a text string in multiple source files
From the File menu, choose Find In Files.
In the Find what box, type the search text or a regular expression.
Tip Select the menu button to the right of the box to display a list of regular search expressions. When you select an expression from this list, the expression is substituted as the search text in the Find what box. If you do use regular expressions, be sure the Regular expression check box is selected. You can also use the drop-down list to select from a list of up to 16 previous search strings.
In the In files/file types box, select the file types you want to search.
You can use the drop-down list to select from common file types or to type text specifying other file types.
In the In folder box, select the primary folder that you want to search. Click the Browse button to display the Choose Directory dialog box if you want to change drives and directories.
If necessary, select one or more of the Find options.
If you want to direct the search output to a second Find in Files pane, select the Output to pane 2 check box.
To select additional folders to search, click the Advanced button.
The Look in additional folders portion of the dialog box appears.
If necessary, select the Look in folders for project source files check box or the Look in folders for project include files check box, or both.
Note These project source and project include file folders are the same as the project’s directory paths.
To add a folder to the Look in additional folders list, double-click the empty selection. Then type the path and filename, or click the Browse button to display the Choose Directory dialog box to change drives and directories.
To remove a folder from the Look in additional folders list, select the folder and press DEL.
The Visual C++ environment retains the contents of the Find In Files list between uses of the Find In Files command in any single session.
Click the Find button to begin the search.
The Output window displays the list of file locations where the text string appears. Each occurrence lists the fully qualified filename, followed by the line number of the occurrence and the line containing the match.
To open a file containing a match, double-click the entry in the Output window.
An editor window containing the file opens, with the line containing the match selected. You can jump to other occurrences of the text string by double-clicking the specific entries in the Output window, or you can use the GoToNextErrorTag command.
When you jump to a found string location specified in the Output window, the corresponding source file is loaded if it is not already open in the editor.
Note The Output window is a virtual window that is maintained even when it is not displayed. You can display the output from your last multiple-file search done during your current session by choosing the Output command from the View menu and by choosing the Find In Files tab in the Output window.