Table Of Contents

Setting Environment Variables

Last Modified: November 20, 2019

Use this procedure to create a custom execute which sets environment variables using the setx command on the target computer.
  1. In the Root property, select [System (32-bit)].
  2. Set the Executable Path to the name of the command prompt executable:
    cmd.exe
  3. In the Arguments property, provide the arguments needed to pass in a string to the command prompt and then run setx:
    /c setx <Name> <Value>

    The /c flag carries out the command specified and then terminates.

    This command replaces <Name> and <Value> with the name of the environmental variable you are creating or editing, and the value you wish to assign to that variable.

    spd-note-note
    Note  

    You can add flags to the setx command. The /m flag is most common and writes the variable in the system environment and not the default local environment.

  4. Click OK.
spd-note-caution
Caution  

You can create a custom execute to remove these environment variables when uninstalling the package. Repeat the procedure but select the Post All Uninstall option while setting up the custom execute. In step 3, use /c setx <Name> “” to reset the variables. However, you should exercise caution when using this process. If multiple packages share the environment variables, using this command can cause these packages to fail after uninstalling the package.


Recently Viewed Topics