【问题标题】:NSIS custom page input from command line从命令行输入 NSIS 自定义页面
【发布时间】:2017-08-03 13:42:29
【问题描述】:

我使用 nsis 为我的程序编写了一个安装程序。 它应该安装在多台机器上,所以我尝试从命令行执行它,但我有一个包含文本框的自定义页面。

页面只有一个文本框:

要安装的服务数量

我正在尝试像这样执行它:

C:\install.exe /S 8 C:\MyDir\   (Second paramter is the INSDIR for the next page)

但它不起作用。

任何想法都会有所帮助。

【问题讨论】:

    标签: arguments installation nsis silent


    【解决方案1】:

    /S 参数保留用于静默安装(不确定是否可以覆盖)。要提供$INSTDIR作为参数,可以使用保留参数/D(参见examples)。

    由于您没有提供您当前使用的代码,这里有一个如何解析命令行参数的通用示例:

    !include "FileFunc.nsh"
    
    Var NumServices
    
    Function .onInit
        ${GetParameters} $0
        ${GetOptions} $0 "/services=" $NumServices
    Function
    

    服务的数量存储在全局变量 $NumServices 中,您可以在 nsDialogs(或 InstallOptions)页面上使用它。

    【讨论】:

    • 我不能在不更改我的 nsis 代码的情况下注入价值吗?
    • /S 和 /D 在 .onInit 之前被解析,你不能覆盖它们。
    • 好的,我使用了 GetParmeters。谢谢
    猜你喜欢
    • 1970-01-01
    • 2021-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-15
    • 2011-09-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多