# AG\_SETENV
> [HTML Version](ag_setenv.htm)
_Reviewed and revised December 2023_
**tab(-10, AG\_SETENV); var=value; chr(127);** [Tab(-10,x) Syntax Notes](ag_xxx_syntax-notes.htm.md)
AG\_SETENV (77) is used to set an environment variable.
This function has both a [subroutine and a print tab implementation](subroutine-print-pairs.htm.md).
**Parameters**
_var_
environment variable to set
_value_
value to set the environment variable to
**Example**
? TAB(-10,AG\_SETENV);"APEX=%MIAME%\\cache";chr(127);
This defines (or redefines) the environment variable APEX to equal the specified directory, after first expanding the environment variable MIAME. Note that the APEX environment variable determines where ATE puts the print files captured for local print or preview operations.
**See Also**
• [MX\_SETENV](mx_setenv.htm.md)[xs](keyword-types.htm.md) for setting an environment variable on the application server as opposed to client
• [SETENV.LIT](systemcommands.htm.md)