Command line

By default, you can run Aba Search and Replace from the command line as abareplace. If you unchecked Allow to run from the command line during the installation, please run the installer again and leave it checked.

The syntax is:

abareplace [/S:pat] [/R|/B:repl] [/C] [/W] [/E] [path\] [filenames...]
/S:pattern Search for the pattern
/R:replacement Replace with the replacement
/B:replacement Batch replacement
/C Match case
/W Match whole word
/E Match with regular expressions

Search from command line

To search for 2022, please use:

abareplace /s:2022 C:\Documents

You can specify a directory or a file to search in. If you want to search only in some files, please put the directory path first, finish it with \, then put the file names separated with spaces:

abareplace /s:2022 C:\Documents\ file1.txt file2.txt

In the current version, you cannot search in multiple files from different directories.

If you set only the pattern, Aba searches in the current directory, so you can run it from command line like this:

abareplace /s:pattern

If you set only the directory, Aba uses a pattern from the last search.

You also can use switches to match case-sensitively /c, match the whole word only /w, or match with regular expressions /e. For example, to search for acronyms (words consisting only of capital letters), please try:

abareplace /s:"\b[A-Z]{2,}\b" /e /c


abareplace /s:"[A-Z]{2,}" /e /c /w

By default, all switches are off, so Aba does a case-insensitive search without regular expressions.

Escaping in command line

After /s, you can specify the pattern to search for; after /r and /b, you can specify the replacement. Both can contain special characters, especially when using regular expressions.

If the pattern contains spaces, please put it into double quotes:

abareplace /s:"slithy toves"

If you need to search for a double quote and your pattern also contains spaces, please double the quotation mark. For example, to search for "in quotes":

abareplace /s:"""in quotes"""

If your pattern contains a caret^ or a vertical line|, then you also need to put the whole pattern into double quotes:

abareplace /s:"^(<ul>|<p>)" /e

This is because the caret and the vertical line have a special meaning (escape character and pipe) in Windows command line.

Note that in PowerShell, double-quoting the vertical line won't help, so you need to use both double and single quotes:

abareplace /s:'"<ul>|<p>"' /e

PowerShell also uses curly braces{} for its own purposes, so if you need them in your pattern, please enclose the whole pattern in double quotes.

In batch files, you need to double the percent character, e.g. to search for width:100%:

@echo off
abareplace /s:width:100%%

Replace from command line

You can use all parameters that you used for searching from the command line.

The syntax for replacing:

abareplace /s:pattern /r:replacement C:\Documents

Please put the replacement after /r. If the replacement contains spaces or special characters, enclose it into double quotes (see the details above):

abareplace /s:borogoves /r:"slithy toves"

If you want to make batch replacements without any user interaction, please use /b:replacement instead of /r:replacement. The switches for regular expressions /e, whole-word matching /w, and case-sensitive matching /c also work with /b:replacement.

Note that both /s:pattern and /b:replacement must be specified, otherwise Aba will ask you for the pattern. Aba will also stop and show you the usual window if it encounters any error in the file name or in the pattern. You may have to raise the limit on the number of matches if you have more than 4096 of them.

If the directory is not specified, Aba replaces files in the current directory. You can undo a batch replacement from the Undo tab if you don't like the result.

When using /b:replacement from a batch file, you need to wait until Aba finishes the replacement before starting the next command. Please add start /w before the command, for example:

start /w abareplace /s:2011 /b:2022 C:\Users\Public\Documents\AbaTutorial

If the replacement was successful, the exit code (errorlevel) is zero.

Silent installation

If you need to automate installing Aba, please pass the uppercase /S switch to the installer. You can also specify the directory to install in:

abareplace25setup /S /D=C:\Program files\Aba

Both /S and /D switches are case-sensitive; you must specify = after /D; you should not put the directory path in quotes. The /S switch also works for the uninstaller.

This is a page from Aba Search and Replace help file.