¿Cómo detectar Windows de 32 bits o 64 bits utilizando el script NSIS?


He escrito el script nsis para el proyecto java.Tengo un archivo por lotes en mi proyecto.He escrito un archivo por lotes para Windows comúnmente de 32 bits y 64 bits.Después de instalar he iniciado el archivo por lotes automáticamente usando el comando Exec .Su woks bien en ventanas de 32 bits.pero al mismo tiempo esto no funciona bien en 64 bit.so sospecho que antes de instalar debo comprobar si Windows es de 32 bits o versión de 64 bits.por favor comparta sus puntos de vista ¿cómo comprobar?

 28
Author: Ami, 2012-11-05

3 answers

Utilice la macro RunningX64 en el x64.nsh cabecera:

!include LogicLib.nsh
!include x64.nsh

Section
${If} ${RunningX64}
    DetailPrint "64-bit Windows"
${Else}
    DetailPrint "32-bit Windows"
${EndIf}  
SectionEnd
 29
Author: Anders,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-10 15:36:19

Para futuros googlers perezosos - Un pequeño fragmento:

Incluya esto:

!include x64.nsh

Y use esto si:

${If} ${RunningX64}
    # 64 bit code
${Else}
    # 32 bit code
${EndIf}       
 59
Author: Nitay,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-03 13:23:45

Esto es lo que uso la mayoría del tiempo sin la necesidad de 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

Ahora Bit Bit contiene 64 o 32 que se pueden usar así:

${If} $Bit == 64
     ...64-bit code..
${Else}
     ..32-bit code...
${EndIf}

O

StrCmpS $Bit 64 SixtyFour ThirtyTwo

SixtyFour:
    ...
    Goto End
ThirtyTwo:
    ...
End:

Usé StrCmpS ya que creo que es un pelo más rápido. Lol. Espero que esto ayude! =)

 -1
Author: demon.devin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-06-05 21:59:37