WSH » WshEnvironment » Remove

Syntax:
object.Remove (strName)
strName
Receives the name of the system environment variable to be removed.

The Remove method deletes the environment variable with the specified name. If no such environment variable exists, a runtime error will be generated.

Examples

Code:
Set objShell = WScript.CreateObject("WScript.Shell")
Set objSysEnv = objShell.Environment("SYSTEM")
objSysEnv.Remove("MyVar1")
Explanation:

The following JScript code removes the System environment variable named "MyVar1".

Language(s): JavaScript

See Also: