Brian_Larsen
asked on
HTA vs Vbs
Hi
In VBS this code tells you what bit version of windows is installed on the machine (32 vs 64 bit)
Set oShell = CreateObject("WScript.Shel l")
WindowsProcessorArchitectu re = oShell.ExpandEnvironmentSt rings("%PR OCESSOR_AR CHITECTURE %")
But in HTA this excact same code gives the wrong vaule!? If I run the code in a vbs file is gives me x86 on a 32 bit and AMD64 on a 64 bit windows.
But in HTA it gives me x86 on all version of windows. Is there another way to read Environment Strings in HTA?
Regard Brian
In VBS this code tells you what bit version of windows is installed on the machine (32 vs 64 bit)
Set oShell = CreateObject("WScript.Shel
WindowsProcessorArchitectu
But in HTA this excact same code gives the wrong vaule!? If I run the code in a vbs file is gives me x86 on a 32 bit and AMD64 on a 64 bit windows.
But in HTA it gives me x86 on all version of windows. Is there another way to read Environment Strings in HTA?
Regard Brian
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just tested, and it returns AMD64 for me using System and x86 using Process
ASKER
Hey jostrander
I think you are right. I am reading about WOW64 as we speak. I will test your code and let you know ASAP.
But that will mean that HTA runs in a 32 bit enviroment and vbs dosen't? Anyway I also stumbleupon this site i my quest for answers wich explains it pretty well:
http://mark.koli.ch/2009/10/reliably-checking-os-bitness-32-or-64-bit-on-windows-with-a-tiny-c-app.html
And there is some confusion about if this code will give the same result as well:
Get-WmiObject -class "Win32_Processor" -property "AddressWidth"
If the AddressWidth is "32" then you're on a 32-bit operating system. If the AddressWidth is "64" then you're on a 64-bit operating system. Some says it dos other that it dosen't. I can't really find any information from microsoft to verify this.
I think you are right. I am reading about WOW64 as we speak. I will test your code and let you know ASAP.
But that will mean that HTA runs in a 32 bit enviroment and vbs dosen't? Anyway I also stumbleupon this site i my quest for answers wich explains it pretty well:
http://mark.koli.ch/2009/10/reliably-checking-os-bitness-32-or-64-bit-on-windows-with-a-tiny-c-app.html
And there is some confusion about if this code will give the same result as well:
Get-WmiObject -class "Win32_Processor" -property "AddressWidth"
If the AddressWidth is "32" then you're on a 32-bit operating system. If the AddressWidth is "64" then you're on a 64-bit operating system. Some says it dos other that it dosen't. I can't really find any information from microsoft to verify this.
ASKER
Ohh you replied while I was writing my comment. Well it sounds promising then. Will test it tomorrow at work, don't have a 64 bit computer at home. Thanks
Not sure, but I think you can change the environment that the HTA runs in... it's basically Internet Explorer, so I think if you set IE 64 bit as the default, it would change that. I wouldn't recommend that though.
ASKER
Hey Jostrander
Just tested your code and it works as expected.
I also found out that you can test for the variable %PROCESSOR_ARCHITEW6432%. So if you run a 32 bit process in wow64 mode, then it creates an Environment Variable called PROCESSOR_ARCHITEW6432 in the "Process" (not "System").
http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
Thanks for taking the time to help me out and put me in the right direction, really appreciate it.
Regards Brian
Just tested your code and it works as expected.
I also found out that you can test for the variable %PROCESSOR_ARCHITEW6432%. So if you run a 32 bit process in wow64 mode, then it creates an Environment Variable called PROCESSOR_ARCHITEW6432 in the "Process" (not "System").
http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
Thanks for taking the time to help me out and put me in the right direction, really appreciate it.
Regards Brian
ASKER
spot on