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?
How to detect windows 32bit or 64 bit using NSIS script?
Not worded as a duplicate question, but its the same: use-one-nsis-installer-to-install-32-bit-binaries-on-32-bit-os-and-64-bit-binari –
Muffler
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
Thanks.In that url said ; File some.dll # extracts to C:\Windows\System32. what is some.dll? which file it mean to?. i could not able to understand –
Opportunity
oh thanks.that {If} part where am i put in my script? .oninit()? or some other place? –
Opportunity
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}
Does this detect all 64-bit architectures or just windows xp x64? –
Calorifacient
I couldn't find a definite answer, I always assumed it does! I've tested it on Windows 7 64bit and Windows XP 64 bit and it worked. I never had any trouble with it on any Windows platform –
Crater
It applies to all 64-bit versions of Windows. (It calls IsWow64Process internally) –
Neoclassic
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
Thanks.In that url said ; File some.dll # extracts to C:\Windows\System32. what is some.dll? which file it mean to?. i could not able to understand –
Opportunity
oh thanks.that {If} part where am i put in my script? .oninit()? or some other place? –
Opportunity
Here's what I use most of the time without the need for x64.nsh
Var Bit
System::Call "kernel32::GetCurrentProcess()i.s"
System::Call "kernel32::IsWow64Process(is,*i.r0)"
StrCmpS $0 0 +3
StrCpy $Bit 64
Goto +2
StrCpy $Bit 32
Now $Bit holds either 64 or 32 which can be used like this:
${If} $Bit == 64
...64-bit code..
${Else}
..32-bit code...
${EndIf}
Or
StrCmpS $Bit 64 SixtyFour ThirtyTwo
SixtyFour:
...
Goto End
ThirtyTwo:
...
End:
I used StrCmpS
as I believe it's a hair faster. Lol. Hope this helps! =)
© 2022 - 2024 — McMap. All rights reserved.