NSIS-使用命令行参数跳过某些对话框吗?

时间:2018-11-24 10:42:11

标签: dialog installer nsis silent-installer unattended-processing

是否可以使NSIS安装程序跳过某些对话框?

它具有这些命令行参数,

/S/NCRC/D=dir

尽管/S/NCRC可用于静默模式和无人值守模式,但是是否有命令行参数使安装程序跳过安装程序中的某些对话框并显示其余对话框?例如。跳过“欢迎”对话框和接下来的两个对话框,然后转到第四个对话框。

1 个答案:

答案 0 :(得分:1)

/ S,/ NCRC和/ D =是唯一具有内置支持的安装程序参数,您需要自己处理其他任何事情。

通过在页面预回调中调用def index if params[:term].present? @houses = House.search(params[:term]) else @houses = House.search('*') end end

Pages can be skipped。也可以jump forward a specific number of pageshouses宏可用于解析命令行。

Abort

GetOptions身份运行以跳过两者。

或者:

OutFile Test.exe
RequestExecutionLevel user
InstallDir $Temp

!include LogicLib.nsh
!include FileFunc.nsh

Page License LicPre
Page Components CmpPre
Page Directory "" DiShow
Page InstFiles

Var SkippedL
Var SkippedC

!macro AbortIfCmdlineParam Switch Var
${GetParameters} $0
ClearErrors
${GetOptions} $0 "${Switch}" $0
${IfNot} ${Errors}
    ${If} ${Var} = 0
        StrCpy ${Var} 1
        Abort
    ${EndIf}
${EndIf}
!macroend

Function LicPre
!insertmacro AbortIfCmdlineParam "/SkipL" $SkippedL
FunctionEnd

Function CmpPre
!insertmacro AbortIfCmdlineParam "/SkipC" $SkippedC
FunctionEnd

Function DiShow
# Disable back button if both pages skipped, this is optional
${If} $SkippedL <> 0
${AndIf} $SkippedC <> 0
    GetDlgItem $0 $hwndparent 3
    EnableWindow $0 0
${EndIf}
FunctionEnd

Section
SectionEnd

...并以Test /SkipL /SkipC的身份运行。