设置SetEnvironmentVariable只是对当前进程起作用!SetEnvVariable才是全局的。

解决方案 »

  1.   

    BOOL SetEnvVariable(LPSTR szName, LPSTR szValue, CMO cmo);SetEnvVariable sets the specified environment variable to a certain value. The environment variable can also be elongated by specifying the command option flag fAppend or fPrepend. Under Windows NT, the environment variables affected are the ones specified in the registry. Under Windows 95, autoexec.bat is modified to set the values.ArgumentsszNameSpecifies the name of the environment variable.szValueSpecifies the new value that you want to associate with the environment variable.cmoSpecifies the command option flag. You can use fOverwrite, fAppend, or fPrepend.Return ValueIf the function succeeds, it returns fTrue.
    If the function fails, it returns fFalse.See AlsoRemoveEnvVariable