Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Replace In Files Command 

Replaces text in files using a subset of the options available on the Replace in Files tab of the Find and Replace window.


Edit.ReplaceinFiles findwhat replacewith [/all] [/case]
[/ext:extensions] [/keep] [/lookin:searchpath] [/options] [/regex]
[/reset] [/stop] [/sub] [/text2] [/wild] [/word]

findwhat

Required. The text to match.

replacewith

Required. The text to substitute for the matched text.

/all or /a

Optional. Replaces all occurrences of the search text with the replacement text.

/case or /c

Optional. Matches occur only if when the uppercase and lowercase characters exactly match those specified in the findwhat argument.

/ext: extensions

Optional. Specifies the file extensions for the files to be searched.

/keep or /k

Optional. Specifies that all modified files are left open.

/lookin: searchpath

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.

/stop

Optional. Halts the current search operation if one is in progress. Replace ignores all other arguments when /stop has been specified. For example, to stop the current replacement you would enter the following:

>Edit.ReplaceinFiles /stop
/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
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft