Remove Method

 

Description

 

Removes an existing environment variable.

 

PowerBASIC Syntax

 

METHOD Remove ( _

BYVAL bstrName AS STRING _

)

 

Arguments

 

bstrName

BSTR. String value indicating the name of the environment variable you want to remove.

 

Remarks

 

The Remove method removes environment variables from the following types of environments: PROCESS, USER, SYSTEM, and VOLATILE. Environment variables removed with the Remove method are not removed permanently; they are only removed for the current session.

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

LOCAL pWsh AS IWshShell

LOCAL pWshEnv AS IWshEnvironment

LOCAL vType AS VARIANT

 

pWsh = NEWCOM "WScript.Shell"

' Get a reference to environment collection

vType = "PROCESS"

pWshEnv = pWsh.Environment(vType)

pWshEnv.Item(UCODE$("TestVar")) = UCODE$("Windows Script Host")

pWsh.Remove UCODE$("TestVar")

 

Valid XHTML 1.0 Transitional