merrix Software Architect Premium join:2002-09-25 Los Angeles, CA
| %PROGRAMFILES% Environmental Variable
Is there an environmental variable that points to C:\Program Files on Win32 and C:\Program Files (x86) on Win64?
When i echo $env:PROGRAMFILES from powershell on Win64 I get C:\Program Files instead of C:\Program Files (x86)
Thanks in advanced |
|
TheRul You couldn't think of something? Premium join:2007-09-18 Victorville, CA ·Verizon FIOS
1 edit | What I have found is %programfiles(x86)% but I can not try that, as I do not have a 64 bit system available.
When was the last time you stabbed someone? »[signup] Diplomacy - Stab Me, Stab you |
|
GILXA1226 Premium,MVM join:2000-12-29 London, OH clubs:
| said by TheRul :What I have found is %programfiles(x86)% but I can not try that, as I do not have a 64 bit system available. When was the last time you stabbed someone? »[signup] Diplomacy - Stab Me, Stab you I can confirm that this works, at least on a windows 7 64-bit install. -- We don't give a d@mn for the whole state of Michigan... we're from OHIO! O!H! ... I!O! |
|
merrix Software Architect Premium join:2002-09-25 Los Angeles, CA
| said by GILXA1226 :said by TheRul :What I have found is %programfiles(x86)% but I can not try that, as I do not have a 64 bit system available. When was the last time you stabbed someone? »[signup] Diplomacy - Stab Me, Stab you I can confirm that this works, at least on a windows 7 64-bit install. how did you confirm? cmd? powershell?
the real question i guess is does %programfiles(x86)% fall back correctly on win32? |
|
TheRul You couldn't think of something? Premium join:2007-09-18 Victorville, CA ·Verizon FIOS
| What I have read is that the %programfiles% variable is automatically changed to %programfiles(x86)% when it is used by a 32 bit program. So if your program is using %programfiles% it should do just fine if you are doing everything 32 bit. But if you are trying to do this in a 64 bit prog, it is not going to matter either way, because you will not be able to use it on a 32 bit system. -- When was the last time you stabbed someone? »[signup] Diplomacy - Stab Me, Stab you |
|
merrix Software Architect Premium join:2002-09-25 Los Angeles, CA | reply to merrix just to be clear i am seeking a single environmental variable that when used on a 64 bit system points to C:\Program Files (x86) and when used on a 32 bit system points to C:\Program Files.
Sorry for the confusion |
|
TheRul You couldn't think of something? Premium join:2007-09-18 Victorville, CA | Then that will be %programfiles% |
|
Graycode
join:2006-04-17 ·net2phone
| reply to merrix The answer depends on what's asking for for the value. If you're using a 32-bit application like a 32-bit installer then you may not get the same value as when using a 64-bit application on the same machine.
From within a 64-bit application you may need to first query for %ProgramFiles(x86)%, and if that doesn't exist then use %ProgramFiles%. From within a 32-bit application then %ProgramFiles% alone may suffice.
If you're using a CMD (DOS Prompt runs as 64-bit on a 64-bit machine) or BAT file, then just type SET to see all environment variables.
Also there are cases where you may need to pay attention to case sensitivity. See: »support.microsoft.com/kb/950407 |
|
GILXA1226 Premium,MVM join:2000-12-29 London, OH clubs:
| reply to merrix said by merrix :said by GILXA1226 :said by TheRul :What I have found is %programfiles(x86)% but I can not try that, as I do not have a 64 bit system available. When was the last time you stabbed someone? »[signup] Diplomacy - Stab Me, Stab you I can confirm that this works, at least on a windows 7 64-bit install. how did you confirm? cmd? powershell? the real question i guess is does %programfiles(x86)% fall back correctly on win32? cmd, and I doubt it would fall back correctly. -- We don't give a d@mn for the whole state of Michigan... we're from OHIO! O!H! ... I!O! |
|
merrix Software Architect Premium join:2002-09-25 Los Angeles, CA | reply to merrix ok I think the answer is no there is no single environmental variable that will do that. |
|