Windows 7 64-bit programfiles environment variable

10,033

Yes, Windows automatically maps folder and file access to c:\program files for 32-bit programs to c:\program files (x86). Visual Studio as well as MSBuild are 32-bit programs. Same is true for c:\windows\system32 vs c:\windows\syswow64.

Share:
10,033
PhilBrown
Author by

PhilBrown

merge delete

Updated on July 26, 2022

Comments

  • PhilBrown
    PhilBrown over 1 year

    Does anyone know if windows 7 will somehow defer back to the "ProgramFiles(X86)" environmental variable when the "ProgramFiles" variable is used?

    We have a situation where a developer is using visual studio and the proj file references assemblies using "$(ProgramFiles)". The machine is 64-bit and the "ProgramFiles" variable points to "C:\Program Files", however the assemblies are in "C:\Program Files (X86)" yet the project builds. It does not build if the literal "C:\Program Files" path is used. The compiler says it cannot find the assemblies

  • PhilBrown
    PhilBrown over 13 years
    Thank you. That's what I thought.
  • Keith Hill
    Keith Hill almost 12 years
    I don't think this is true except for the use of the environment variable %ProgramFiles% which does automatically provide the correct path depending on the bitness of the process. The reason the OP's situation works is because VS is 32-bit and $(ProgramFiles) refers to the environment variable %ProgramFiles% which will be C:\Program Files (x86) for a 32-bit process on a 64-bit OS. If I fire up a 64-bit exe in C:\Program Files\Acme\foo64.exe from a 32-bit process the OS just switch the path on me to C:\Program Files (x86)\Acme\foo64.exe.