Search and Replace Command Line Parameters

The command -line parameters are below.

Notes:

  • Search and Replace has many Options settings. As you review the available switches below please note that not all aspects of the program have a counterpart command line switch. The last program default in effect when the program was run will be used for settings that do not have a command line switch. If you need to control various options from the command line we suggest using a script. If you are using the build in script editor, the ‘Options’ button in the Advanced Tab can be used to specify the settings you need.

  • Very Important: If you are launching a script via the /c switch, add /s to launch Search and Replace and automatically initiate a search. If your script involves a replace, use /r in your command line to initiate the replace. Also see important notes concerning the operation in effect for Linked Scripts when launched from the command line.

  • The flags below can be upper or lower case.

  • The /i /x /d /w flags can be used separately or together in any order.

  • Do not leave spaces between switches that reference a file or path and the path specification.

  • Surround paths that have spaces with ” characters.

  • To run the program in a minimized state and with no interface, use /u. See Minimized Mode.

  • We recommend using the Windows, ‘start /w’ launcher when you more than a single program instance defined in a .bat/.cmd file. See your Windows F1 hlp or type ‘start /?’ from a MSDOS box for more information on the ‘start’ command.

Some example command lines are:

   SR32 /Oc:\dump.txt /SWindows /Pc:\windows\*.ini
   SR32 /I /D /Oc:\dump.txt /SWindows /Pc:\windows\*.ini
   SR32 /c”c:\scripts\main.srs” /r /q

 

Search and Replace Command Line Switches

/b

Backup path, e.g., /Bc:\temp\srbackup. See Replace Options

/i

Case Insensitive. Note that this option is the reverse of what the user interface shows. If not specified, Case Sensitive is assumed.

/x

Regular Expression. If not specified, it is assumed off. If you want to search for ‘binary‘ characters, specify /x.

/w

Match Whole Word (ignored if Regular Expression is used). If not specified, it is assumed off.

/sstring

Search String to use. This automatically starts a Search. If the string contains spaces or / characters, enclose it in double quotes as with the /r switch above. If the string contains ” characters, use the \ character to denote the literal. For example, if your search string contains both quotes and a space, as in “Windows 95″, you would use,
     
SR32 /S”\”Windows 95\”"

Note: To do a File Find from the command line, specify /s but supply no string.

/rstring

Perform a replace. This can be used either with scripts via /c switch (see below) or by itself with a replace string. If the string contains spaces or / characters, enclose it in double quotes as in /s below. If the string contains ” characters, use the \ character to denote the literal. For example, if your replace string contains both quotes and a space, as in “Windows 98″, you would use,
     
/r”\”Windows 98\”"

/d

Search Subdirectories. If not specified, it is assumed off.

/pC:\*.ini;*.txt

Path to search with mask(s) appended after the \. If no path or masks are specified, the last program default is used. The /p switch command line parameter accepts partial paths, including .. characters, e.g.,
     
/Pc:file.txt or /Ppfile.txt or /P..\test\file.txt or /P\file.txt.

/oresults.txt

Output file to send the search results to. If not specified, the last program default is used (this is specified in the Options dialog).

/cscript.srs

Script file to use. Use /s to initiate a search. If the script involves a replace, use /r to initiate a replace.

/n

“No Prompts”. Works only with /r. Note: This resets program options so you should manually restore prompts settings after using /n (see Options dialog).

/t

Perform a Touch on the files specified. You can specify a date/time stamp or use the current date/time (default). For the 32-bit version, the user’s date format is used and the HH:MM:SSam/pm format is used for time. For the 16-bit version, the same time format is used but the MM/DD/YY or MM/DD/YYYY format is used for date. The Touch dialog is only displayed if the date/time stamp passed on the command line is in the wrong format. The date & time MUST be enclosed in double quotes to work properly, e.g.,
     
SR32 /pc:\work\*.* /t”01/01/00 1:00:00am”.

/u

Disables the user interface. Use this to run the program ‘silently’. There will be no Taskbar entry. For no user interface during replaces, disable replace confirmations with /n or the ‘Prompt_flag=2′ setting in your script. Note: If you also don’t want error messages about file locking or replacements in binary files, use Quiet Mode in Options|Genaral.

/q

Quit after operation. The Search & Replace window will close after the operation is completed.

Command Line Switches