Shell.SetEnvironmentVariable

Top  Previous  Next

 

Syntax

function Shell.SetEnvironmentVariable(VarName: string; VarValue: string): integer

 

Alternative Names

Shell.SetEnvVar
ibec_SetEnvironmentVariable

 

Description

Sets the value of an existing Windows environment variable or creates a new one with the given name and value if it doesn't exist.

 

VarName is the name of the environment variable, VarValue is the new value for the variable.

 

The Return Value is non-zero if the call succeeds and zero otherwise. You can use GetLastError to get information about the error.

 

See Also

Shell.GetEnvironmentVariable

 

Example

execute UDSBlock 

as

begin

  /* get Windows temp folder */
  temp_folder = Shell.GetEnvironmentVariable('TEMP');

 

  GUI.ShowMessage(temp_folder);

 

  /* change temp folder */

  Shell.SetEnvironmentVariable('TEMP', 'd:\temp\');

 

  temp_folder = Shell.GetEnvironmentVariable('TEMP');

 

  GUI.ShowMessage(temp_folder);

end