</head> <body> <h1>EnvSet</h1> <p>Writes a value to a <a href="../Variables.htm">variable</a> contained in the environment.</p> <pre class="Syntax"><span class="func">EnvSet</span>, EnvVar, Value</pre> <h2 id="Parameters">Parameters</h2> <dl> <dt>EnvVar</dt> <dd>Name of the <a href="../Concepts.htm#environment-variables">environment variable</a> to use, e.g. "COMSPEC" or "PATH".</dd> <dt>Value</dt> <dd><p>Value to set the <a href="../Concepts.htm#environment-variables">environment variable</a> to.</p></dd> </dl> <h2 id="Error_Handling">Error Handling</h2> <p><span class="ver">[v1.1.04+]</span>: This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p> <p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p> <h2 id="Remarks">Remarks</h2> <p>The operating system limits each environment variable to 32 KB of text.</p> <p>An environment variable created or changed with this command will be accessible only to programs the script launches via <a href="Run.htm">Run</a> or <a href="Run.htm">RunWait</a>. See <a href="../Concepts.htm#environment-variables">environment variables</a> for more details.</p> <p>This command exists separately from <a href="SetEnv.htm">SetEnv</a> because <a href="../Variables.htm">normal script variables</a> are not stored in the environment. This is because performance would be worse and also because the OS limits environment variables to 32 KB.</p> <h2 id="Related">Related</h2> <p><a href="EnvGet.htm">EnvGet</a>, <a href="_NoEnv.htm">#NoEnv</a>, <a href="../Concepts.htm#environment-variables">environment variables</a>, <a href="EnvUpdate.htm">EnvUpdate</a>, <a href="SetEnv.htm">SetEnv</a>, <a href="Run.htm">Run</a>, <a href="Run.htm">RunWait</a></p> <h2 id="Examples">Examples</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> Writes some text to the AutGUI variable contained in the environment.</p> <pre>EnvSet, AutGUI, Some text to put in the variable.</pre> </div> </body> </html>