Microsoft® Windows® Script Host Remove Method |
WSH Reference Version 1 |
Deletes the environment variable specified by strName.
object.Remove(strName)
Part Description object WshEnvironment object. strName The name of the environment variable to delete.
The following example deletes the EXAMPLE volatile environment variable and then deletes multiple variables from the User environment:Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Environment("VOLATILE").Remove("EXAMPLE") Set WshUsrEnv = WScript.Environment("User") WshUsrEnv.Remove("EXAMPLE_1") WshUsrEnv.Remove("EXAMPLE_2") WshUsrEnv.Remove("EXAMPLE_3") WshUsrEnv.Remove("EXAMPLE_4")