putenv

putenv creates new environment variables; modifies or removes existing ones.

bool = putenv(ssEnvString)

Return Value

return TRUE (1) if successful, or 0 in the case of an error.

Parameters

ssEnvString

ssEnvString is a string.

Comment

ssEnvString is a string of the form varname=string, where varname is the name of the environment variable to be added or modified and string is the variable’s value. If varname is already part of the environment, its value is replaced by string; otherwise, the new varname variable and its string value are added to the environment. You can remove a variable from the environment by specifying an empty string - in other words, by specifying only varname=.

The function affects only the environment that is local to the current process.

Example

ssPath = getenv("path");
putenv("path=c:\mydir;c:\mydir\mydir2;" + ssPath);

See also

getenv

id-681352