【问题标题】:Calling another program in nsis silent installation在 nsis 静默安装中调用另一个程序
【发布时间】:2017-11-03 06:05:57
【问题描述】:

我的软件已经有一个 nsis 安装程序。为了支持在静默安装程序中注册(我们在代码中编写了复杂的逻辑,而不是通过 nsis 操作注册表),我创建了一个 exe,它接受 2 个参数:RegName 和 RegKey 用于注册。现在我想在静默安装中使用两个参数调用这个 exe 文件,这个调用必须是可选的,并且取决于用户是否传递了这两个参数。

所以需求归结为:

-- 静默安装只处理密钥和注册名 -- 如果整体安装成功,则调用我的 exe

【问题讨论】:

  • 请提供您现有代码的MCV example,否则无法为您提供帮助。如果您没有任何代码,StackOverflow 是错误的地方 - 请尝试 NSIS 论坛!

标签: nsis silent-installer


【解决方案1】:
OutFile "myinstaller.exe"
RequestExecutionLevel user

!include LogicLib.nsh
!include FileFunc.nsh


Function CheckRegistryParameters
${GetParameters} $0
${GetOptions} "$0" "/RegKey" $1
${GetOptions} "$0" "/RegName" $2
${If} $1 != ""
${AndIf} $2 != ""
    WriteRegStr HKCU "Software\Test\$1" "Name" "$2"
    Exec '"yourapplication.exe" "$1" "$2"'
${EndIf}
FunctionEnd

Section
${If} ${Silent}
    Call CheckRegistryParameters
${EndIf}
SectionEnd

并以myinstaller.exe /S /RegKey "Hello" /RegName "World" 运行

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-25
    • 1970-01-01
    • 2021-06-28
    • 1970-01-01
    • 1970-01-01
    • 2012-11-05
    • 1970-01-01
    相关资源
    最近更新 更多