Environment

Gets a System environment variable.

Syntax:

Environment (env-variable)

Parameters:

(s) env-variable any defined environment variable.

Returns:

(s) environment variable contents.

 

Use this function to get the value of a system environment variable.

Note: It is not possible to change a DOS environment variable from within Windows.

The function returns values of any length up to the current system's environment variable value length limit.

In 32-bit Windows, you no longer need to update the environment. Basically the registry database commands can do the job for you.

For Windows, use the RegApp function to tell the system what path to use for various exe files. You can update this just before launching the app. If WinBatch is going to launch the program, you can also try the EnvironSet function along with the RunEnviron function. After you have changed the PATH with the EnvironSet function, you can take a look at the new settings by displaying in a message box the path:

; Display the PATH for this session

currpath = Environment("PATH")

Message("Current System Path", currpath)

; Display the Environment for this session

allenv=EnvItemize()

Message("Environment Settings", allenv)

 

Note that the EnvItemize function displays alot more stuff than does the Environment("PATH").

Example:


; Display the PATH for this session
currpath = Environment("PATH")
Message("Current Path", currpath)
See Also:

EnvItemize, RunEnviron, EnvironSet, IniRead, RegApp