Environ$()

Syntax

Environ$(EnvironmentVariable$)

Remarks

In Windows 3.x and Windows 95, returns a string associated with EnvironmentVariable$. For example, tempdir$ = Environ$("TEMP") returns the folder associated with the TEMP environment variable. On the Macintosh, Environ$() is not available and generates an error.

Environment variables are normally set using MS-DOS® batch files (such as AUTOEXEC.BAT) or the System option in Control Panel in Windows NT. For more information about environment variables, see your system documentation.

Example

This Windows example checks the PATH environment variable and displays one of two message boxes based on the number of characters in the path. (The limit is 127 characters.)


path$ = Environ$("PATH")
length = Len(path$)
avail = 127 - length
Select Case avail
    Case 127
        MsgBox "The PATH is empty."
    Case 0 To 126
        MsgBox "You can add" + Str$(avail) + \
                " character(s) to the PATH."
    Case Else
End Select

See Also

AppInfo$(), GetProfileString$(), GetSystemInfo