Environment Variables - Remove

Declaration

<AMENVVARS ACTIVITY="delete" NAME="text" TYPE="text (options)" />

Related Topics   

Description

Removes a machine, user or process level environment variable.

NOTE: Any user can add, modify, or remove a user environment variable. However, only an administrator can add, modify, or remove a system environment variable.

Practical usage

Normally used to get rid an existing environment variable that is no longer needed.

Parameters

Environment Variable

Property Type Required Default Markup Description
Variable scope Text Yes User
  • TYPE="user"
  • TYPE="machine"
  • TYPE="process"
The scope or level in which the environment variable to remove belongs to. The available options are:
  • User (default) - Remove a user-level environment variable.
  • Machine - Remove a machine-level environment variable.
  • Process - Remove a process-level environment variable.
Environment Variable Text Yes (Empty) NAME="TEMP" The name of the environment variable to remove.

Description

Error Causes

On Error

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task demonstrates a number of activities related to environment variables. An Environment Variable - Set activity creates a new environment variable of type "User" named "AMTemp" along with the value of "Automate Training". A Variable - Create activity creates an Automate Desktop variable named "EnvironmentVarValue." An Environment Variable - Get activity populates the Automate Desktop variable with the value of the newly created environment variable. Thereafter, a Dialog - Message activity displays the value of the created environment variable. The final step deletes the environment variable with the use of the Environment Variables - Remove activity.

Copy
<AMENVVARS ACTIVITY="set" TYPE="USER" NAME="AMTemp" VALUE="Automate Training" />
<AMVARIABLE NAME="EnvironmentVarValue"></AMVARIABLE>
<AMENVVARS TYPE="USER" NAME="AMTemp" RESULTVARIABLE="EnvironmentVarValue" />
<AMSHOWDIALOG>The value of environment variable 'AMTemp' is '%EnvironmentVarValue%'.</AMSHOWDIALOG>
<AMENVVARS ACTIVITY="delete" TYPE="USER" NAME="AMTemp" />