Page 1 of 1 1
Topic Options
#212087 - 2016-11-09 09:57 PM %programfiles% displays x86 path on 64bit Windows.
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4560
Loc: USA
Am I having a senior moment (aka a Glenn moment)? I swear I have been using %programfiles% in my scripts correctly and now it seems that it is displaying the wrong value. When I use %programfiles% now on a 64bit windows, it displays the x86 variant. I've tried changing WOW64FileRedirection to on and off, and I seem to remember Ruud saying the WOW64FileRedirection does not effect the program files directory. I tried an older version of Kix and its doing it too... so maybe I've been off all this time... wth?
Top
#212088 - 2016-11-09 10:57 PM Re: %programfiles% displays x86 path on 64bit Windows. [Re: Allen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
I can verify said behavior. The following code...
 Code:
? "%programfiles%"
?
? "%programfiles(x86)%"
get $
Produces the following output...
 Quote:

C:\Program Files (x86)

C:\Program Files (x86)
Even though the two are not the same when I use Set at a command prompt. The use of SetOption does not seem to have any effect.

Top
#212089 - 2016-11-10 12:41 AM Re: %programfiles% displays x86 path on 64bit Windows. [Re: ShaneEP]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4560
Loc: USA
I'm not sure How In The World I've had this wrong for so long, but here it is in print...
https://msdn.microsoft.com/en-us/library...ror=-2147217396

Kix is a 32 bit process, so by the definition above, %ProgramFiles% will be redirected to the x86 directory...

It so stupid the way they've handled all this redirection.

Top
#212091 - 2016-11-11 12:50 PM Re: %programfiles% displays x86 path on 64bit Windows. [Re: Allen]
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 309
Loc: STRASBOURG, France
hello,

you can read directly values in the registry
look at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
and read value "ProgramFilesDir" or "ProgramFilesDir (x86)"

take care to WOW64AlternateRegView option. Be sure to read the real key not this redirect in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion
_________________________
Christophe

Top
#212093 - 2016-11-11 02:38 PM Re: %programfiles% displays x86 path on 64bit Windows. [Re: ChristopheM]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4560
Loc: USA
oh you mean this? ;\)

 Code:
function ProgramFiles()
  dim $Prev
  $Prev=setoption("WOW64AlternateRegView","On")
  $ProgramFiles=readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProgramFilesDir")
  $Prev=setoption("WOW64AlternateRegView",$Prev)
endfunction


Thanks for the input tho, if I had been looking for it, you can bet we would have been struggling to find it. \:\)

Top
#212102 - 2016-11-13 03:27 PM Re: %programfiles% displays x86 path on 64bit Windows. [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
I resemble that remark! \:D

Even though, I usually use the ARCH() function and set things based on that.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1005 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.055 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org