Set Environment Variable

Verb: setEnvVar

Sets a value to an environment variable.

Environment variables are a set of dynamic values (variables) that hold operating system information.

Syntax

setEnvVar --target(SystemEnvironmentVariables) --name(String) --value(String) (Boolean)=value

Inputs

Script Designer Required AcceptedTypes Description
--target Variable´s environment Required SystemEnvironmentVariables Select the environment where the variable is stored, which can be one of the options below:
  • Machine
  • Process
  • User
  • --name Variable Required Text Variable to which the value should be set.
    --value Value Required Text Value that should be set to the variable.

    Outputs

    Script Designer AcceptedTypes Description
    value Success Boolean "True" if the variable value was correctly set, or "False" otherwise.

    Example

    Defines the "IBM" environment variable in the User environment and sets a value to it.

    defVar --name result --type Boolean
    setEnvVar --target "User" --name IBM --value "Market leading platform\r\n" result=value
    logMessage --message "${result}" --type "Info"
    // This example produces the following result:
    // True
    

    Remarks

    After running the command, to check the variable in Windows, go to: My Computer-> Properties-> Advanced System Settings-> Advanced Tab-> Environment Variables.