Set-FileReplaceText

Replaces strings in arbitrary files. The command does not work line-oriented like the Edit-OemLine command, but replaces each string to be searched by the changed string. Therefore, no wildcards are allowed in the Find and Replace with text fields.

Note: This command should only be used with caution with binary files. Often binary files have internal checksums that will be corrupted by such a change.



Settings:

  • File(s)
    File(s) to be changed. The use of variables and placeholders is possible. Separate multiple entries with spaces.
  • Path
    Path to the file(s) to be changed. The specification can be made with or without a final "\".
  • Find
    The actual string to be replaced must be specified, wildcards are not allowed.
  • Replace with
    The string that replaces the string to be searched for. Again, no wildcards are allowed.
  • Restrict replacement to text files
    Allows to restrict the application to text files. The mime type is used as a recognition feature. It is recommended to use this option.
  • Include subdirectories
    Applies the command to all subdirectories of the directory specified in path.
  • Use 32-Bit mode on x64 computer
    If the script is executed on a 64-bit operating system, the counterpart for 32-bit applications SysWOW64 can be used automatically when referring to the SYSTEM32 directory.


Example:

The following example replaces the string c:\temp with d:\temp in all text files with the extension .config in the specified directory and all subdirectories.


Corresponds to DSM eScript command:

  • Replace


See also: