Home > Language Reference > System Functions > Envir$

Envir$

The Envir$ function returns the value of an environment variable.

Syntax

var$ = Envir$(<variable_name>)

Parameters

<variable_name>. string, name of the environment variable to retrieve.

Return value

var$, string, content of the environment variable.

Remarks

Envir$ can retrieve any Windows environment variables, but for the variables defined by the SET command, the SET command must have been done by the script in the current session.

Examples

var$ = Envir$("ProgramFiles")
'var$ contains the Program files folder
msgbox(var$)

var$=Envir$("AppData")
'var$ contains the Application Data folder of the logged-in user
msgbox(var$)