Previous Topic: EnvGetNext - Retrieve the Name of the Subsequent Environment VariablesNext Topic: EnvImport - Import Environment Variables


EnvGetString - Retrieve the Value of an Environment Variable

Valid on UNIX and Windows

The EnvGetString function retrieves the value of an environment variable.

This environment function has the format:

EnvGetString(name as string) as string 
name

Defines the name of the environment variable.

The function returns a string containing the value associated with name. If an environment variable specified by name does not exist, the function returns an empty string.

Example: EnvGetString function

This example displays the current search path.

Rem variable `MyPath´
Rem 
Dim txt as String

txt = EnvGetString("PATH")

Print("The path: "+txt)
EnvSetString("MyPath",txt)
Print("My path: "+txt)