Skip to main content

Set Environment Variable

AutomatR.DefaultActivities.Environment.SetEnvironmentVariable

The "Set Environment Variable" activity in AutomatR allows you to set or update an environment variable, providing the name, value, and target type (Process, User, or Machine). This activity simplifies the process of managing environment variables within automation workflows.

Properties

NameDescription
Input
Variable NameEnter the name of the environment variable to be set or updated.
Variable ValueEnter the value for the environment variable.
TargetSelect the type of environment variable for setup (e.g., Process, User, or Machine).
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variable or argument containing the desired display name.
Optional
DelaySpecifies the amount of time (in seconds) to wait before executing the "Set Environment Variable" activity. This can be useful for handling synchronization issues. Integer variable or argument containing the delay duration. Example: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1.

How to use:

  1. Drag and drop the "Set Environment Variable" activity onto the workflow.
  2. Configure the properties by specifying the name, value, and target type of the environment variable.
  3. Optionally, configure the delay and customize the display name.
  4. Execute the workflow to set or update the specified environment variable.

Example: Consider an example where the "Set Environment Variable" activity is used to set or update the value of the "TEMP" environment variable:

Set Environment Variable:
Display Name: "Set TEMP Variable"
Variable Name: "TEMP"
Variable Value: "C:\Temp"
Target: User

In this example, the activity sets or updates the value of the "TEMP" environment variable for the user, specifying the value "C:\Temp." The operation is performed without direct output; however, the updated value can be retrieved using the "Get Environment Variable" activity if needed.