NSIS-静默自动更新应用程序 [英] NSIS - Silent Autoupdate Application

查看:389
本文介绍了NSIS-静默自动更新应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

谢谢! :)

推荐答案

(以防您需要检测命令行/Autoupdate = yes)

(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

这篇关于NSIS-静默自动更新应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆