简体   繁体   English

NSIS静默安装程序-未观察到跳转

[英]NSIS silent installer - jump not observed

I am trying NSIS doc example for silent installer, here . 我想NSIS文档例如对于静默安装, 在这里 Uncommenting the line 取消注释行

; SilentInstall silent

then yes, my installer is silent. 那是的,我的安装程序没有声音。 However, it displays message boxes. 但是,它显示消息框。 It is expected that message boxes do appear even if installer is silent. 即使安装程序处于静默状态,也可能会出现消息框。 To make message boxes silent as well, one has to play with /SD option for each message box. 要使消息框也保持静音,必须为每个消息框使用/ SD选项。 The example script proposes it here: 示例脚本在此处提出建议:

MessageBox MB_OK|MB_ICONINFORMATION "This is not a silent installer" /SD IDOK

Another mean to make the message box silent is exposed: it checks if silent. 使消息框保持沉默的另一种方法是公开的:它检查是否保持沉默。 If silent, then jump two lines ahead (so do not show message box) 如果保持沉默,则向前跳两行(因此不显示消息框)

IfSilent 0 +2
    MessageBox MB_OK|MB_ICONINFORMATION 'This is a "silent" installer'

This second solution does not work for me. 第二种解决方案对我不起作用。 If i set the installer silent, the box with 'this is a silent installer' does appear. 如果我将安装程序设置为静默,则会出现带有“这是一个静默安装程序”的框。 If i change it for 如果我改变它

MessageBox MB_OK|MB_ICONINFORMATION 'This is a "silent" installer' /SD IDOK

the message does not appear. 该消息不出现。

Why is the jump in 为什么跳进去

IfSilent 0 +2

not working? 不工作吗? +3 is not making it either. +3也不行。

Like zbynour said, you got the parameters mixed up. 就像zbynour所说的,您混淆了参数。

To avoid issues with relative jumps, use the logiclib: 为了避免相对跳转的问题,请使用逻辑库:

!include LogicLib.nsh

...

${IfNot} ${Silent}
  MessageBox ...
${EndIf}

Because the first argument is offset to jump in case of silent installation (the second one for non-silent). 因为在无提示安装的情况下,第一个参数偏移以跳转(第二个参数为非静默)。

Try this: 尝试这个:

IfSilent +2 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM