SetEnvironmentVariable

  BOOL SetEnvironmentVariable(lpName, lpValue)    
  LPTSTR lpName,;    
  LPTSTR lpValue;    

The SetEnvironmentVariable function sets the value of an an environment variable for the current process.

Parameters

lpName

Points to a null-terminated string that specifies the environment variable whose value is being requested.

lpValue

An optional pointer to a null terminated string that is to be the new value of the specified variable name. If this parameter is NULL, then the variable will be deleted from the current process's environment.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

The SetEnvironmentVariable function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

GetEnvironmentVariable