请问怎样设置windows下的环境变量?

解决方案 »

  1.   

    The SetEnvironmentVariable function sets the contents of the specified environment variable for the current process. BOOL SetEnvironmentVariable(
      LPCTSTR lpName,  // environment variable name
      LPCTSTR lpValue  // new value for variable
    );Parameters
    lpName 
    [in] Pointer to a null-terminated string that specifies the name of the environment variable. The operating system creates the environment variable if it does not exist and lpValue is not NULL. 
    lpValue 
    [in] Pointer to a null-terminated string that specifies the contents of the environment variable. An environment variable has a maximum size limit of 32,767 bytes, including the trailing null terminator. 
    If this parameter is NULL, the variable is deleted from the current process's environment.