Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect windows 32bit or 64 bit using NSIS script?

Tags:

nsis

I have written nsis script for java project.I have Batch file in my project.I have written batch file for commonly windows 32bit and 64 bit.After installing i have started batch file automatically using Exec command.Its woks fine in 32bit windows.but the same time this is not worked well in 64 bit.so i suspect that before installing i should check whether windows is 32 bit or 64 bit version.please share your views how to check?

like image 790
Ami Avatar asked Nov 05 '12 09:11

Ami


People also ask

How do I find my NSIS version?

Description. A simple function to return the version of Windows that the script is running on. It can detect Windows 95 through Windows 8.1, returns the version number if it is Windows NT 3 or 4 and returns a blank string if it can not determine the Windows version.

Can 32bit software run on 64bit?

The 64-bit versions of Windows don't provide support for 16-bit binaries or 32-bit drivers. Programs that depend on 16-bit binaries or 32-bit drivers can't run on the 64-bit versions of Windows unless the program manufacturer provides an update for the program.


2 Answers

For future lazy googlers - A small snippet:

Include this:

!include x64.nsh 

And use this if:

${If} ${RunningX64}     # 64 bit code ${Else}     # 32 bit code ${EndIf}        
like image 75
Nitay Avatar answered Sep 23 '22 20:09

Nitay


Use the RunningX64 macro in the x64.nsh header:

!include LogicLib.nsh !include x64.nsh  Section ${If} ${RunningX64}     DetailPrint "64-bit Windows" ${Else}     DetailPrint "32-bit Windows" ${EndIf}   SectionEnd 
like image 34
Anders Avatar answered Sep 21 '22 20:09

Anders