Help Center
Help CenterFreeBASIC

Environfunction

Returns the value of a system environment variable

Operating System Functionsfunctiondocumented

Syntax

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

Parameters

NameDescription
varnameThe name of an environment variable.

Return value


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

Description


Environ returns the text value of a system environment variable.

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


Example


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



Print Environ("path")


Reference

  • Documented in KeyPgEnviron.html