CLIENTENV() Function - Get Client Side O/S Environment Variables

Syntax

CLIENTENV(str{,IND=int}{,ERR=lineref})

Description

In BBj 4.0 and higher, the CLIENTENV() function returns the value of a specified operating system environment variable from the client side of a thin client session.

Parameter

Description

str

Operating system environment variable.

IND=int

IND=0 forces the variable lookup to be case-sensitive.

IND=1 forces the variable lookup to be case-insensitive.

If this parameter is omitted, the variable lookup is case-sensitive on UNIX and Linux and case-insensitive on Windows.

ERR=lineref

Branch to be taken if an error occurs during execution.

If the specified environment variable does not exist, an !ERROR 11 is returned.

Note: From a fat client, an !ERROR 11 is always returned. The -FC option has been obsolete since BBj 5.00.

BUI logo

For security reasons, browsers are not given access to the user's operating system environment variables.

In the BUI and DWC clients, the CLIENTENV() function returns any key=value query parameters specified in the URL query string. For example, given a BUI app loaded with the URL http://localhost:8888/apps/sample?company=01&user=jsmith, the clientenv("company") would return "01" and clientenv("user")would return "jsmith"

Examples

rem ' Retrieve the name of the client side Windows command processor

PRINT CLIENTENV("COMSPEC")
C:\WINNT\SYSTEM32\CMD.EXE

rem ' Retrieve the name of the client side shell on UNIX or Linux
PRINT CLIENTENV("SHELL")
/bin/ksh

See Also

Functions - Alphabetical Listing