Skip to content
⌘ NSIS Forum Archive

How tell if the target is a 64-bit or not

6 posts

sethradio#

How tell if the target is a 64-bit or not

Is there some way to create a script that tells whether the target computer is a 64-bit computer, and if it is, do some action that would not be done if it were a 32-bit machine?

Thanks in advance.
Brummelchen#
read help file chapter "4.2.3 Constants"
  ;Var BITVERSION
  ;Var ERROR
  ;32/64bit
  ;Call bitversion
  ;StrCmp $ERROR "1" jump_error
Function bitversion
  GetVersion::WindowsPlatformArchitecture
  Pop $BITVERSION
  StrCmp $BITVERSION "64" bit64
  StrCmp $BITVERSION "32" 0 error
  ;bit32:
    SetRegView 32
    Sleep 500
    Goto done
  bit64:
    ; disable registry redirection (enable access to 64-bit portion of registry)
    SetRegView 64
    Sleep 500
    Goto done
  error:
    StrCpy $ERROR "1"
  done:
  ;messagebox mb_ok "'$BITVERSION'"
FunctionEnd 
Afrow UK#
You don't need to use GetVersion for this, just use x64.nsh as MSG pointed out.
${If} ${RunningX64}
...
${Else}
...
Stu