ReplaceText

ReplaceText is used to replace text in files. You can enter the search text and what to replace it with in the command line, or prepare a file with pairs of searched text-replace with, with each string on a separate line. The set of pairs allows you to replace multiple pairs, whereas the command line parameter only one pair.

Replacing one pair

Use:

ReplaceText <filepath> <codePageNumber> <textToFind> <textToReplace>

where

  • <filepath> is the file to be searched.

  • <codePageNumber> is the code page of the searched file (see below).

  • <textToFind> is the searched string. The match must be exact, including lower case / upper case.

  • <textToReplace> is the text that will replace the searched string.

Example:

ReplaceText AdminPage.aspx 65001 NavigationGroupName="SupervisorPage" NavigationGroupName="AdminPage"

Replacing multiple pairs

Use:

ReplaceText <filepath> <codePageNumber> <patternfile>

where

  • <filepath> is the file to be searched.

  • <codePageNumber> is the code page of the searched file (see below).

  • <patternfile> is a set of pairs.

The pair file contains pairs of searched text, replace with, with each string on a separate line. Example:

"SupervisorPage"
"Supervisor Page"
"AdministratorPage"
"Administrator Page"
"ActionTriggers"
"Action Triggers"

As the strings are on separate lines, there is no need to “escape” any characters, nor have characters such as " or \ have any special meaning. The match must be exact including lower case / upper case.

In the previous example, we want to find and replace exactly "SupervisorPage", not strings such as SupervisorPage, supervisorpage or substrings Page etc.

Code page

Both variants require the code page of the searched file (and the file with pairs to be replaced with texts in the pair file). For a list of supported code pages, refer for example to .NET Framework documentation, but we strongly recommend using 65001 or UTF-8.