Documentation
Back to website >

GetEnvironmentItem (Pascalscript)

Description

Any environment variable of the PC can be queried and evaluated in scripts via this operating system function.

Syntax

function GetEnvironmentItem(const s: String): string;

Arguments

The name of the environment variable is passed as a string as argument s. With SET you can display all environment variables from the command prompt and test them in the script .

A string is always returned.

Example

begin
 showMessage(GetEnvironmentItem('os'));
end;

Rules to understand the script can be found here.

In this example, the environment variable 'OS' is read out by the operating system and displayed via ShowMessage. The environment variables can be used to modify a report on conditions in the output. This makes it possible to make the printout dependent on the operating system or on completely different circumstances that can be called up via the PC environment.

ShowMessage shows: Windows_NT