Environment Variables - Remove

Declaration

<AMREMOVEENVIRONMENT 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

  1. TYPE="user"

  2. TYPE="machine"

  3. 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 Name

Text

Yes

(Empty)

NAME="TEMP"

The name of the environment variable to remove.

 

Description

Error Causes

On Error

 

example

NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

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 Create Variable action creates an AutoMate variable named "EnvironmentVarValue". An Environment Variable - Get activity populates the AutoMate variable with the value of the newly created environment variable. Thereafter, a Message Box activity displays the value of the created environment variable. The final step deletes the environment variable with the use of the Environment Variables - Delete activity.

<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" />