NSIS - 仅当系统 ID 为 64 位时才在 SectionGroup 中显示 Section

NSIS - show Section in SectionGroup only if system id 64bit

我有一个包含两个部分的部分组

SectionGroup /e "myGroup" GRPCONNECTOR

  Section "sec32" SEC32
   ..
  SectionEnd

  Section "sec64" SEC64
   ..
  SectionEnd 

SectionGroupEnd

两者都显示在组件页面中

现在,如果 运行 OS 是 64 位,我只想显示 SEC64 部分。 我该怎么做?

我尝试使用常见的 ${if}${RunningX64} 但这里失败了。

你走在正确的轨道上。使用 x64.nsh 中的宏来处理 64-bit/WoW 内容,并使用 Sections.nsh 中的辅助宏来处理部分:

SectionGroup /e "myGroup" GRPCONNECTOR
Section "sec32" SEC32
SectionEnd

Section "sec64" SEC64 ; This must be placed before the usage of ${SEC64} in your .NSI file.
SectionEnd 
SectionGroupEnd

!include x64.nsh
!include LogicLib.nsh
!include Sections.nsh

Function .onInit
${IfNot} ${RunningX64}
    SectionSetText ${SEC64} "" ; Hide the section
    !insertmacro UnselectSection ${SEC64} ; And uncheck it
${EndIf}
FunctionEnd

Page Components
Page InstFiles