SetEnvironmentVariable

The SetEnvironmentVariable creates an environment variable, if it does not exist, and sets the contents of the specified environment variable for the current process.

Screenshot

Ports

The SetEnvironmentVariable component exposes the Control In, Control Out, and Data In ports by default.

Port Description
ControlIn Must be connected to the Control Out port of one or more components.
ControlOut Can be connected to the Control In port of another component or the default end component.
Data In The SetEnvironmentVariable component exposes the following Data In ports by default:
variable: specifies the system environment variable or user environment variable to create, or to assign a value(string)
value: sets the value to assign to the specified variable (string)..

Properties

To edit the properties of the SetEnvironmentVariable component, in the Properties window, change the required property. You can edit the following properties.

Property Description
Search Search for the respective property.
Delay After Execution Specifies the wait time (in seconds) after the action is performed.
Delay Before Execution Specifies the wait time (in seconds) before the action is performed.

Example

Let us consider an example in which we create a variable “Tutorials” and assign a value, which is a path, to the variable.

Screenshot

To create a variable and/or assign a value to it:

  1. In the Toolbox, expand Utilities and then expand Environment.
  2. Drag the SetEnvironmentVariable component and drop it on the Design surface.
  3. To specify the variable to create or assign a value, double-click the variable box and enter the required variable name.
  4. To set the value of the specified variable, double-click the value box and enter the required value.

    Note

    You can override the existing data source for both the variable and the value Data In ports.
    To override the existing data source:

    • Right-click the required Data In port.
    • Click Override and change the data source.
      To learn more about overriding the data source of the data port, refer the Override section.

  5. Connect all the control ports in the activity.

  6. In the toolbar, click Run.
    The environment variable is created, if required, and the specified value is assigned to the variable.