Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am installing Visual Studio 2010 and am wondering why the installer doesn't respect environment variables.

ProgramFiles and related variables are configured for the D drive.

PS Env:\> dir program*

Name                           Value
----                           -----
ProgramFiles(x86)              D:\Program Files (x86)
ProgramW6432                   D:\Program Files
ProgramData                    C:\ProgramData
ProgramFiles                   D:\Program Files

But the Visual Studio installer defaults to "C:\Program Files (x86)" anyway.

I can change this to "D:\Program Files (x86)" manually but I do wonder whether Visual Studio just ignores environment variables and whether there is a good reason for that?

share|improve this question
    
Why the downvote? –  Andrew J. Brehm Jul 9 '13 at 15:14
1  
Which environment variables are you referring to? How did you change these? Installers are not looking at environment variables, there is a special API to get the location for folders like ProgramFiles, CommonProgramFiles, AppData, MyFiles, etc. This API gets its information from registry values. The environment variables are not the source for this information, they are set depending on the registry values. –  Werner Henze Jul 9 '13 at 15:38
    
The environment variables I am referring to show in the quoted PowerShell output. I thought the API gets the values stored in the environment variables. –  Andrew J. Brehm Jul 10 '13 at 6:34

1 Answer 1

up vote 0 down vote accepted

I believe that Visual Studio defaults to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir registry key and not the environment variable.

EDIT: Added actual key, not just a variable reference.

share|improve this answer
1  
Can you expand on what you mean by this? %ProgramFiles% is an environment variable. Which exact registry key are you referring to? –  Ƭᴇcʜιᴇ007 Jul 9 '13 at 14:50
    
I do not know the exact registry key but I have run into this issue before. It is probably in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion Which the value there could be different than environment variables –  chancea Jul 9 '13 at 15:02
    
Isn't that basically the machine version of the same variable? So VS uses the machine version, not the user version of the variable? –  Andrew J. Brehm Jul 9 '13 at 15:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.