Mod Tool/Scripting: Difference between revisions

m
no edit summary
(get OS bit version)
mNo edit summary
Line 1: Line 1:
===OS bit version===
===OS bit version===
'''shorter but slower'''
  if GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth = 64 then
  if GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth = 64 then
  logmessage "run 64-bit OS"
  logmessage "64"
  else
  else
  logmessage "run 32-bit OS"
  logmessage "32"
  end if
  end if


'''longer but faster'''
'''faster'''
    Const HKEY_LOCAL_MACHINE = &H80000002
Set WshShell = CreateObject("WScript.Shell")
    Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
if instr(WshShell.RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier"), "x86") = 1 then
    strKeyPath = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"
logmessage "32"
    strValueName = "Identifier"
else
    oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue   
logmessage "64"
    if (InStr(strValue, "x86")) then
end if
        logmessage "32"
    else
        logmessage "64"
    end If




8,452

edits