Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SIx Driver RDD v3.00 - Reference Guide - <b>strtran.exe:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  STRTRAN.EXE:


  The STRTRAN.EXE utility allows you to do a binary search and replace of
  any text within any file or set of files.  This allows you to modify any
  text or symbols within source, header, object, library, or executable
  files.

  STRTRAN.EXE can also be used to simply locate a string of text within a
  file or group of files, without doing any replacements.

  When doing a search and replace of text, the new value must be the exact
  same length as the value being replaced.  This is because this is a binary,
  byte-for-byte replacement, unlike a text insert replacement that a text
  editor or word processor do to text files.  This utility simplifies tasks
  you would normally use a HEX editor for.

  If the new value is shorter than the old value, or if the values to be
  replaced have a space in them, you can surround the values with quotation
  marks, padding the replacement value if necessary.  See the examples
  below for a demonstration of this technique.

  All files that are modified during a replace are backed up to a file with
  the same base name as the original file, but with a .BAK extension.  In
  the event that the file being modified is a *.BAK file itself, it will be
  backed up to a file with a .$$$ extension instead.

  The command-line syntax for using STRTRAN.EXE is as follows:

  STRTRAN <cFileName> <cOldValue> <cNewValue> [Options]

  Where:  cFileName = Name of file(s) to be processed, including extension.
                      Wildcards can be used.  ( Example: *.OBJ )
          cOldValue = String to search for in <cFileName>.
          cNewValue = String to replace all occurrences of <cOldVal> with.
                      This value must be the same length as <cOldValue>.

  Options:  /b = Do not backup original files.  By default, if a file is
                 modified, STRTRAN copies the original file to a .BAK
                 file.  Use of this switch speeds up processing in cases
                 where backups are not required.

            /c = Case-Insensitive Search.  (Replace value is not affected)

            /s = Show finds only;  Don't replace.  If this switch is
                 used, <cNewValue> is not required and will be ignored.

            /v = Verbose display.  Shows file offset and a 50-byte file
                 snippet for each find.

  Examples:

    // Replace all occurrences of SIXCDX with SIXNSX in TEST.PRG
    STRTRAN test.prg SIXCDX SIXNSX

    // Replace all occurrences of Loren Scott with Ceci Smith in FOO.EXE
  * STRTRAN foo.exe "Loren Scott" "Ceci Smith "

    // Replace all occurrences of One( "Foo" ) to Two( "Bar" ) in *.PRG
 ** STRTRAN *.PRG "One( \"Foo\" )" "Two( \"Bar\")"

    // Replace all occurrences of CLIPPER501 with CLIPPER520 in *.OBJ
    STRTRAN *.OBJ CLIPPER501 CLIPPER520

    // Replace all occurrences of Loren or LOREN with Bogus in *.PRG
    STRTRAN *.prg Loren Bogus /c

    // Count the number of occurrences of Loren or LOREN in *.TXT
    STRTRAN *.txt Loren /c /s

    // Same as above, but shows offset and a text snippet for each find
    STRTRAN *.txt Loren /c /s /v

    // Replaces all occurrences of FOO with BAR in TEST.EXE, without
    // creating TEST.BAK
    STRTRAN test.exe FOO BAR /b


  *  - When spaces are contained in either the string to be replaced or the
       replacement string, you must surround the entire string with double
       quotes (").

  ** - If the string being replaced contains double quotes ("), you must
       precede each quotation mark with a backslash (\) to force the quote
       to be handled as part of the string.  The backslash does NOT count
       as part of the length of the string.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson