Writes a value to a variable contained in the environment.

EnvSet EnvVar , Value



Type: String

Name of the environment variable to use, e.g. "COMSPEC" or "PATH".


Type: String

Value to set the environment variable to. If omitted, the environment variable is deleted.

Error Handling

An OSError is thrown on failure.


The operating system limits each environment variable to 32 KB of text.

An environment variable created or changed with this function will be accessible only to programs the script launches via Run or RunWait. See environment variables for more details.

This function exists because normal script variables are not stored in the environment. This is because performance would be worse and also because the OS limits environment variables to 32 KB.

EnvGet, environment variables, Run, RunWait


Writes some text to the AutGUI variable contained in the environment.

EnvSet "AutGUI", "Some text to put in the variable."