Debug GetEnvironmentVariable("ProgramFiles(x86)")
Debug GetEnvironmentVariable("ProgramFiles")
both give c:\program files (x86) back.
Also
Debug GetEnvironmentVariable("Commonprogramfiles(x86)")
Debug GetEnvironmentVariable("commonprogramfiles")
both C:\Program Files (x86)\Common Files
Checked in cmdprompt: Values are different. So why not in PB?
ProgramFiles(x86)=C:\Program Files (x86)
ProgramFiles=C:\Program Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramFiles=C:\Program Files\Common Files
Testing with Windows 10 (don't have a win8 machine at hand at the moment), with PB 5.31 X86
[PB 5.31] GetEnvironmentVariable gives faulty results
-
- User
- Posts: 26
- Joined: Fri Jul 14, 2006 10:27 pm
Re: [PB 5.31] GetEnvironmentVariable gives faulty results
That is an Windows characteristic for x86 programs. Try the x64 Compiler and it should work...
Re: [PB 5.31] GetEnvironmentVariable gives faulty results
No PB bug.
The %ProgramFiles% itself depends on whether the process requesting the environment variable is itself 32-bit or 64-bit (this is caused by Windows-on-Windows 64-bit redirection).
32bit CMD.exe
The %ProgramFiles% itself depends on whether the process requesting the environment variable is itself 32-bit or 64-bit (this is caused by Windows-on-Windows 64-bit redirection).
32bit CMD.exe
- ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
- ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
-
- User
- Posts: 26
- Joined: Fri Jul 14, 2006 10:27 pm
Re: [PB 5.31] GetEnvironmentVariable gives faulty results
Thank you. That's clear and logical. Is there any (purebasic) way around it, expect for using the 64bit purebasic, or runprogram(Getenvironmentvariable("comspec"),"/c echo %programfiles(x86)% > sometext.txt") (something like that)and parsing that output? The program needs to run on both 32 and 64 bit platforms, but I need to be able to access those directories.. And I don't want to hardcode them...
I don't think that runprogram is gonna work either, right?
I don't think that runprogram is gonna work either, right?