NSIS - 静默自动更新应用程序

发布于 2024-08-04 08:03:13 字数 120 浏览 2 评论 0原文

我有一个适用于我的 .net c# 应用程序的 NSIS 安装工具包。

考虑到我已经将新的更新(新的 NSIS 应用程序版本)下载到本地计算机,有没有办法静默自动更新我的应用程序?

谢谢! :)

I have an NSIS install kit for my .net c# application.

Is there a way to silently autoupdate my application, considering that I already downloaded the new update (new NSIS app version) to local computer ?

Thanks! :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

メ斷腸人バ 2024-08-11 08:03:13

(如果您需要检测命令行/Autoupdate=yes)

!include FileFunc.nsh
!insertmacro GetParameters
!insertmacro GetOptions

Var CMD_ARGS
Var CMD_RES
Function .onInit
    #
    #installer stuff.
    #
    StrCpy $CMD_ARGS ""
    StrCpy $CMD_RES "no"
    ${GetParameters} $CMD_ARGS
    ClearErrors
    ${GetOptions} $CMD_ARGS /Autoupdate= $CMD_RES
    StrCmp $CMD_RES "yes" is_update is_not_update
    is_update:
        #Execute all your update code(run your update app, etc)
        MessageBox MB_OK|MB_ICONEXCLAMATION "IS UPDATE"
        goto end_auto_update_check
    is_not_update:
        #Execute all your non-update code.
        MessageBox MB_OK|MB_ICONEXCLAMATION "IS NOT UPDATE"
    end_auto_update_check:
FunctionEnd

(In case you need to detect the command line /Autoupdate=yes)

!include FileFunc.nsh
!insertmacro GetParameters
!insertmacro GetOptions

Var CMD_ARGS
Var CMD_RES
Function .onInit
    #
    #installer stuff.
    #
    StrCpy $CMD_ARGS ""
    StrCpy $CMD_RES "no"
    ${GetParameters} $CMD_ARGS
    ClearErrors
    ${GetOptions} $CMD_ARGS /Autoupdate= $CMD_RES
    StrCmp $CMD_RES "yes" is_update is_not_update
    is_update:
        #Execute all your update code(run your update app, etc)
        MessageBox MB_OK|MB_ICONEXCLAMATION "IS UPDATE"
        goto end_auto_update_check
    is_not_update:
        #Execute all your non-update code.
        MessageBox MB_OK|MB_ICONEXCLAMATION "IS NOT UPDATE"
    end_auto_update_check:
FunctionEnd
碍人泪离人颜 2024-08-11 08:03:13

如果您的意思是这样,您可以静默运行安装程序并在顶部安装:

foo.exe /S /D=C:\Program Files\Foo

You can run the installer silently and install on top if that is what you mean:

foo.exe /S /D=C:\Program Files\Foo

鼻尖触碰 2024-08-11 08:03:13

如果您已设置包脚本来指定静默安装,则无需将 /S 传递到命令行。

查看 NSIS 站点上的silent.nsi 示例 silent.nsi

It's not necessary to pass /S to the command line if you've set up the package script to specify silent installs.

Take a look at the silent.nsi example on the NSIS site silent.nsi

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文