WshEnvironment.Remove

The Remove method deletes the environment variable specified by strName.

Syntax

WshEnvironment.Remove(strName)
 

Example

' Delete the EXAMPLE volatile environment variable
  Set WshShell = Wscript.CreateObject("Wscript.Shell")
  WshShell.Environment("VOLATILE").Remove("EXAMPLE")

' Delete multiple variables
  Set WshUsrEnv = Wscript.Environment("User")
  WshUsrEnv.Remove("EXAMPLE_1")
  WshUsrEnv.Remove("EXAMPLE_2")
  WshUsrEnv.Remove("EXAMPLE_3")
  WshUsrEnv.Remove("EXAMPLE_4")

See Also

WshShell.Environment property