Get an Environment variable used by Windows operating system.
SyntaxEnv$(environmentvar)
Where environmentvar is a string representing a system environment variable such as Path, LOCALAPPDATA, etc.
To see a list of environment variables available for use, open a DOS command prompt and type 'Set' and hit <Enter>.
Return ValueString
DescriptionGet an operating system environament variable such as System TEMP folder, PATH, USERNAME, APPDATA, etc.
Examples
Print Env$("TEMP")
Output should be like 'C:\Temp' or 'C:\Windows\Temp'.
Print Env$(SystemRoot)
Output would typically be 'C:\Windows'Error Conditions
-
If an empty string or non-string parameter is passed to function an error will be thrown.
-
If a non-existent variable name (e.g.: "FooBar") is passed to function an empty string will be returned.
-
This is basically querying for a name that is not set, so an empty string will be returned.