Here is the VBScript version:
On Error Resume Next
Dim WshShell
Dim OsType
Set WshShell = CreateObject("WScript.Shell")
OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
If OsType = "x86" then
wscript.echo "Windows 32bit system detected"
elseif OsType = "AMD64" then
wscript.echo "Windows 64bit system detected"
end if
3 comments:
I belive this method returns 64 bit when you have a 32-bit OS running on 64-bit capable hardware.
Here is a VBScript / WMI one-liner that retrieves the actuals bits number (32 or 64) of the OS or the Hardware, take a look at http://csi-windows.com/toolkit/csi-getosbits
I checked the reg keys on an x64 CPU with an x64 O/S (Windows 7, x64), key = AMD64. I also checked the reg keys for an x64 CPU with an x86 O/S (XP, 32 bit) = x86
Actually it seems to work OK.
Post a Comment