Assigns the specified value to a variable.
Deprecated: This command or a legacy assignment is not recommended for use in new scripts. Use expression assignments like
Var := Value instead.
SetEnv, Var, Value Var = Value
The name of the variable in which to store Value.
The string or number to store. If the string is long, it can be broken up into several shorter lines by means of a continuation section, which might improve readability and maintainability.
By default, any spaces or tabs at the beginning and end of Value are omitted from Var. To prevent this, use the methods described at AutoTrim Off.
The name "SetEnv" is misleading and is a holdover from AutoIt v2. Unlike AutoIt v2, AutoHotkey does not store its variables in the environment. This is because performance would be worse and also because the OS limits the size of each environment variable to 32 KB. Use EnvSet instead of SetEnv to write to an environment variable.
The memory occupied by a large variable can be freed by setting it equal to nothing, e.g.
It is possible to create a pseudo-array with this command and any others that accept an OutputVar. This is done by making OutputVar contain a reference to another variable, e.g.
array%i% = 123. See Arrays for more details.
AutoTrim, EnvSet, EnvAdd, EnvSub, EnvMult, EnvDiv, If (legacy), Arrays
Assigns the value of A_TickCount to a pseudo-array variable.
i = 1 Array%i% = %A_TickCount%