Command line

Syntax, options, and examples for editing environment variables and creating backups from the RapidEE command line.

RapidEE lets you create, delete, and edit environment variables and export them to a .reg file using command-line options.

Syntax

.\RapidEE.exe [options] <variable_name> [value]
.\RapidEE.exe -B [-M] [-U] <file.reg>
.\RapidEE.exe -?

Angle brackets indicate required arguments; square brackets indicate optional ones. Do not type the brackets.

Specify the variable name and its value. The value can contain a list of entries separated by ;. Quote arguments that contain spaces or ;.

Options can use a hyphen (-S) or a slash (/S) and are case-insensitive. The examples use a hyphen.

Options

Actions

OptionAction
-SCreate a variable or replace its entire value. The default action.
-AAppend a value to the list, separated by ;.
-IPrepend a value to the list, separated by ;.
-RRemove all list entries that match the specified value, ignoring case.
-CRemove empty and duplicate entries. Keep the first occurrences.
-DDelete the variable.

If no action is specified, RapidEE uses -S:

.\RapidEE.exe MY_VARIABLE hello

The command sets MY_VARIABLE to hello.

Variable scope and type

OptionAction
-UCurrent user’s variables. The default scope.
-MSystem variables. Changes usually require administrator privileges.
-EStore the value as an expandable string (REG_EXPAND_SZ).
-NStore the value as a normal string (REG_SZ).

Backup and help

OptionAction
-BExport variables to a .reg file.
-?Show help.

Examples

Create or replace a variable

.\RapidEE.exe -S -U MY_VARIABLE "hello world"

The command creates the user variable MY_VARIABLE with the value hello world, or replaces its current value.

Store a reference to another variable

.\RapidEE.exe -S -E -U MY_TOOLS "%USERPROFILE%\Tools"

The command stores %USERPROFILE%\Tools as an expandable string. PowerShell passes the reference literally.

In cmd.exe, place ^ before each % to prevent the shell from expanding the reference before RapidEE starts:

.\RapidEE.exe -S -E -U MY_TOOLS ^%USERPROFILE^%\Tools

The REG_EXPAND_SZ type allows Windows to expand references later, when it builds the environment.

Add a directory to PATH

.\RapidEE.exe -A -C -U PATH "C:\Tools\bin"

The command appends the directory to the user PATH. -C removes empty and duplicate entries from the result.

.\RapidEE.exe -I -C -M PATH "C:\PriorityTools\bin"

The command prepends the directory to the system PATH and cleans up the result. Run it with administrator privileges.

Remove a list entry

.\RapidEE.exe -R -U PATH "C:\Tools"

The command removes all matching entries from the user PATH, ignoring case. -R compares complete entries: C:\Tools does not match C:\Tools\bin or C:\Tools\. To remove several different entries, run a separate command for each one.

Delete a variable

.\RapidEE.exe -D -U MY_VARIABLE

The command deletes the user variable MY_VARIABLE.

Clean up a list

.\RapidEE.exe -S -C -U MY_LIST "one;two;one;;two"

The command sets MY_LIST to one;two.

-C cleans up the operation’s result, keeping the first occurrences in their original order. The paths C:\Tools\, C:/Tools, and C:\Tools are considered identical: case, separator style, and trailing slashes are ignored.

Backup

.\RapidEE.exe -B "C:\Backups\environment.reg"

The command exports system and user variables.

.\RapidEE.exe -B -M "C:\Backups\system.reg"

The command exports only system variables.

.\RapidEE.exe -B -U "C:\Backups\user.reg"

The command exports only user variables.

The destination directory must exist. An existing file is overwritten. To restore a backup, import the .reg file using Windows Registry Editor. Importing system variables requires permission to change them.

Using scripts

Exit codeMeaning
0The operation completed successfully.
1An error, such as a missing variable name, denied registry access, or a failure to write the file.
$process = Start-Process -FilePath '.\RapidEE.exe' `
    -ArgumentList '-S', '-U', 'MY_VARIABLE', 'hello' `
    -Wait -PassThru
if ($process.ExitCode -ne 0) {
    throw 'Could not update the environment variable.'
}

Start-Process -Wait -PassThru waits for RapidEE to finish and returns the process with its exit code. If an error occurs, the script throws an exception.

After changing a variable, RapidEE notifies other applications. Existing PowerShell and cmd.exe processes keep their previous environment. Launch a new shell from an application that has refreshed its environment.

Options for the RapidEE_setup.exe installer are documented separately: silent installation.