[Win32utils-devel] GetTempPath vs GetEnvironmentVariable vs getenv

Heesob Park phasis at gmail.com
Mon Mar 24 22:31:53 EDT 2008


2008/3/25, Berger, Daniel <Daniel.Berger at qwest.com>:

>  Hi all,
> I discovered some interesting quirks with regards to getting environment
> variable information on Windows. It's because 'TMP' is considered a system
> environment variable, which you can't change with SetEnvironmentVariable()
> according to the docs.

I don't think so. 'TMP' can be changed with SetEnvironmentVariable().
But it affected only the current running process and child processes.
Environment variable can be categorized into three levels: process, user and
system level.
You can change user and System environment variable persistently via
registry setting.

>  The odd thing about TMP is that my shell value doesn't match the registry
> setting. The 'set' output shows:
> TMP=C:\DOCUME~1\djberge\LOCALS~1\Temp
> But the registry entry, under
> HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session
> Manager\Environment, is set to:
> C:\Temp

User environment variables are stored in the Registry in the key:


System variables are found in the key:

Refer to http://vlaurie.com/computers2/Articles/environment.htm


Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080325/64b0e14d/attachment.html 

More information about the win32utils-devel mailing list