windows_programming_notes.nbk: Home | Index | Next Page: SetFileAttributes | Previous Page: SetDlgItemText
SetEnvironmentVariable
Sets the contents of the specified environment variable for the current process.
Snytax
BOOL WINAPI SetEnvironmentVariable(
__in LPCTSTR lpName,
__in_opt LPCTSTR lpValue
);
Parameters
- lpName
The name of the environment variable. The operating system creates the environment variable if it does not exist and lpValue is not NULL.
lpValue
The contents of the environment variable. The total size of the environment block for a process may not exceed 32,767 characters. For more information, see Environment Variables.
If this parameter is NULL, the variable is deleted from the current process's environment.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
This function has no effect on the system environment variables or the environment variables of other processes.
Requirements
- Client Requires Windows Vista, Windows XP, or Windows 2000 Professional.
- Server Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
- Header Declared in Winbase.h; include Windows.h.
- Library Use Kernel32.lib.
- DLL Requires Kernel32.dll.
- Unicode Implemented as SetEnvironmentVariableW (Unicode) and SetEnvironmentVariableA (ANSI).
windows_programming_notes.nbk: Home | Index | Next Page: SetFileAttributes | Previous Page: SetDlgItemText
Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time