Replace In Files Command
Replaces text in files using a subset of the options available in the Replace in Files dialog box.
Edit.ReplaceinFiles findwhat replacewith [/all] [/case] [/ext:extensions] [/keep] [/lookin:searchpath] [/options] [/regex] [/reset] [/stop] [/sub] [/text2] [/wild] [/word]
- Required. The text to search for.
- Required. The text to replace the search text.
- /all or /a
- Optional. Replaces all occurrences of the search text with the replacement text. This is similar to the Replace All In dialog box.
- /case or /c
- Optional. Matches occur only if when the uppercase and lowercase characters exactly match those specified in the findwhat argument.
- Optional. Specifies the file extensions for the files to be searched.
- /keep or /k
- Optional. Specifies that all modified files are left open.
- Optional. Directory to search. If the path contains spaces, enclose the entire path in quotation marks.
- /options or /t
- Optional. Displays a list of the current find option settings and does not perform a search.
- /regex or /r
- Optional. Uses pre-defined special characters in the findwhat argument as notations that represent patterns of text rather than the literal characters. For a complete list of regular expression characters, see Regular Expressions.
- /reset or /e
- Optional. Returns the find options to their default settings and does not perform a search.
- Optional. Halts the current search operation if one is in progress. Replace ignores all other arguments when
/stophas been specified. For example, to stop the current replacement you would enter the following:
- /sub or /s
- Optional. Searches the subfolders within the directory specified in the /lookin:searchpath argument.
- /text2 or /2
- Optional. Displays the results of the replacement in the Find Results 2 window.
- /wild or /l
- Optional. Uses pre-defined special characters in the findwhat argument as notations to represent a character or sequence of characters. For a complete list of wildcard characters, see Wildcards.
- /word or /w
- Optional. Searches for only whole words.
This example searches for btnCancel and replaces it with btnReset in all .cls files located in the folder "my visual studio projects" and displays the replacement information in the Find Results 2 window.
>Edit.ReplaceinFiles btnCancel btnReset /lookin:"c:/my visual studio projects" /ext:.cls /text2
Visual Studio Commands with Arguments | Command Window | Find/Command Box | Replace in Files Dialog Box | Find Results Windows | Pre-defined Visual Studio Command Aliases | Searching Using Results Lists