Command line 命令行选项和跳过页面

Command line 命令行选项和跳过页面,command-line,installation,command-line-arguments,nsis,Command Line,Installation,Command Line Arguments,Nsis,我正在使用NSIS创建一个安装程序,其中包括一些内置页面和一些自定义页面。在这种情况下,我只想在安装过程中传递命令行时使用install显示自定义页面。如何完成 !include FileFunc.nsh !include LogicLib.nsh Page Custom MyPageCreate Function MyPageCreate ${GetParameters} $0 ClearErrors ${GetOptions} "$0" "/ShowSpecial" $1 ${If}

我正在使用NSIS创建一个安装程序,其中包括一些内置页面和一些自定义页面。在这种情况下,我只想在安装过程中传递命令行时使用install显示自定义页面。如何完成

!include FileFunc.nsh
!include LogicLib.nsh

Page Custom MyPageCreate

Function MyPageCreate
${GetParameters} $0
ClearErrors
${GetOptions} "$0" "/ShowSpecial"  $1
${If} ${Errors}
    Abort ; Skip page
${EndIf}
nsDialogs::Create 1044
nsDialogs::Show
FunctionEnd
范例

!include "MUI.nsh"
!include nsDialogs.nsh

OutFile "myCustomPage.exe"
var installmethod
Page Custom MyCustomPage 
Page Custom MyCustomPage1 
Page Custom MyCustomPage3

Function MyCustomPage
 nsDialogs::Create 1044

     nsDialogs::Show

FunctionEnd
Function MyCustomPage1
 nsDialogs::Create 1044

     nsDialogs::Show

FunctionEnd
Function MyCustomPage3
 nsDialogs::Create 1044

     nsDialogs::Show
FunctionEnd
Section Dummy
SectionEnd

在上面的示例中,我有3个页面。在正常安装期间,我只想显示两个页面MyCustomPage和MyCustomPage3。如果通过了命令行(指定命令行),则在安装过程中应显示所有3页。如何执行此操作?

如果命令行选项为“a”,则下面的代码跳过MyCustomPage1页

!include FileFunc.nsh
!include LogicLib.nsh

Page Custom MyPageCreate

Function MyPageCreate
${GetParameters} $0
ClearErrors
${GetOptions} "$0" "/ShowSpecial"  $1
${If} ${Errors}
    Abort ; Skip page
${EndIf}
nsDialogs::Create 1044
nsDialogs::Show
FunctionEnd

解释一下你是怎么做的会有帮助的。你好,安德烈斯。请检查我下面的答案。您使用过getoption等。我的方法有问题吗?它工作正常。但我的方法是有效的和正确的?如果你永远不支持其他参数,不关心引号,那么你的版本是好的…我使用其他命令行,但不跳过这些页面。如果有引号呢?你能解释一下吗${GetParameters}只要抓取命令行字符串,${GetOptions}就解析它,寻找你指定的子字符串。。。