Skip to content

Environ

Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › Operating System Functions › Environ

Environ

Returns the value of an environment variable, or an empty string if it is not set.

Syntax

Declare Function Environ ( ByRef varname As Const String ) As String

Parameters

  • varname

Description

Environ returns the text value of a system environment variable.

Return Value

Returns the text value of the environmental variable, or the empty string ("``") if the variable does not exist.

Remarks

Usage

result = Environ[$]( varname )

Differences from QB

  • The QB ENVIRON statement is now called SetEnviron. The string type suffix "$" is required in the -lang qb dialect.
    The string type suffix "$" is optional in the -lang fblite dialect.
    The string type suffix "$" is ignored in the -lang fb dialect, warn only with the -w suffix compile option (or -w pedantic compile option).

See also

Examples

'e.g. to show the system variable "path":

Print Environ("path")

Category: Operating System Functions
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally