putenv

Sets an operating system environment variable.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X X X X

Syntax

string putenv(env-pair)
string        env-pair

Description

Sets one or more operating system environment variable(s). The env-pair variable is a double-quoted string of an environment variable name and its value. You can specify multiple name-value pairs separated by a comma. The environment variable change is not persistent. That is, it is only set for the session. It returns the env-pair string.
env-pair specifies the variable(s) to set, and its value(s).

Example

Sets the environment variable PRINTER to lpt300.
putenv("PRINTER=lpt300");

Sets multiple environment variables: the printer as well as paper size.

putenv("PRINTER=lpt3001,PAPER=letter");