The Remove method deletes the environment variable with the specified name. If no such environment variable exists, a runtime error will be generated.
Set objShell = WScript.CreateObject("WScript.Shell")
Set
objSysEnv = objShell.Environment("SYSTEM")
objSysEnv.Remove("MyVar1")The following JScript code removes the System environment variable named "MyVar1".