Archive: Handling 32 bit and 64 bit Win in 1 installer


Handling 32 bit and 64 bit Win in 1 installer
Question I emailed to NSIS:

The NSIS website describes NSIS as “scriptable win32 installer/uninstaller system”.
The Windows 7 on my computer is 64 bit.
Will NSIS work normally on this computer for development?
For my clients who use my NSIS-created installers on 64 bit Windows computers, will installation work normally?
-------------------
Response received via email from NSIS:
Yep.
You can use Include\x64.nsh, $PROGRAMFILES64, etc.
Please use the forums for further questions.
-------------------
Does this mean that it is necessary to have:
- one installer for use on 64 bit computers, and
- another installer for use on 32 bit computers?

I'd prefer to just have one.
If a single installer is possible, please provide code sample to enable this.

!include x64.nsh
${If} ${RunningX64}
;Do x64 stuff.
${Else}
;Do x86 stuff.
${EndIf}

x64.nsh is installed with NSIS by default. Note that your NSIS installer itself will still be a 32 bits application, so it will do 32-bits stuff by default. You can use setregview to reach 64 bits registry. You can use $PROGRAMFILES64 to point to the x64 program files directory. Etc, see the manual.