Writes a value to a variable contained in the environment.

EnvSet, EnvVar, Value



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



ErrorLevel is set to 1 if there was a problem or 0 otherwise.



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

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

Note: An EnvGet command is not provided because referencing a blank or undefined variable will automatically trigger that behavior. For example, in the following line, the value of the ProgramFiles variable (if undefined in the script) will be fetched from the environment:
TargetFile = %ProgramFiles%\Something\setup.ini

This command exists separately from SetEnv 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 32K.



environment variables, EnvUpdate, SetEnv, Run, RunWait



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