# SetEnv (Var = Value)

Assigns the specified value to a variable.

    SetEnv, Var, Value
    Var = Value

### Parameters

Var | The name of the variable in which to store Value.
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.

### Remarks

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. var =

It is possible to create an array with this command and any others that accept an OutputVar. This is done by making OuputVar contain a reference to another variable, e.g. array%i% = 123. See Arrays for more details.

### Related

AutoTrim, EnvSet, EnvAdd, EnvSub, EnvMult, EnvDiv, If, Arrays

### Example

    Var1 = This is a string.
    Color2 = 450
    Color3 = %Var1%
    Array%i% = %A_TICKCOUNT%