Writes an environment variable.
EnvSet ( "envvariable" [, "value"] )
|envvariable||Name of the environment variable to set.|
|value||[optional] Value to set the environment variable to. If a value is not used the environment variable will be deleted.|
A environment variable set in this way will only be accessible to programs that AutoIt spawns (Run(), RunWait()). Once AutoIt closes, the variables will cease to exist.
#include <MsgBoxConstants.au3> Example() Func Example() ; Create an environment variable called %MYVAR% and assign it a value. When you assign or retrieve an environment variable you do so minus the percentage signs (%). EnvSet("MYVAR", "This is some text!") ; Retrieve the environment variable that was just assigned a value previously. Local $sEnvVar = EnvGet("MYVAR") ; Display the value of the environment variable $MYVAR%. MsgBox($MB_SYSTEMMODAL, "", "The environment variable %MYVAR% has the value of: " & @CRLF & @CRLF & $sEnvVar) EndFunc ;==>Example