ENVIRON$ function

Purpose:

ENVIRON$ will retrieve information from the environment table of the operating system.

Syntax:

RetStr = ENVIRON$(EnviroVariable AS INTEGER)

Return Value:

  • Data type: STRING
    RetStr The value of the environment variable.

Parameters:

  • Data type: STRING
    EnviroVariable The name of a system environment variable.

Remarks:

👉 The maximum size for an environment table variable is 32767 bytes. There is the danger of a string buffer overrun if a stock sized 2048 byte string is used as the return string and the size of the environment table variable is larger than 2048. A string should be dynamically sized if the return string buffer is to receive a large value.

System environment variables commonly are used in CGI programming.

Example:

DIM RetStr$

RetStr$ = ENVIRON$("COMPUTERNAME")

PRINT RetStr$