Unable to remove environment variable <name>.

You are calling the method Environment.Remove() on an unrecognized environment variable.

This error generally occurs when using the Remove method. If the environment variable does not exist or is misspelled, the system is not able to remove it.

To correct this error

  • Check the names of the current environment variables and make sure they exist and are spelled correctly.

See Also

Reference

Remove Method (Windows Script Host)

WshEnvironment Object