6

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! :)

Adrian Pirvulescu
  • 4,308
  • 3
  • 30
  • 47

3 Answers3

2

(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
bithavoc
  • 1,539
  • 15
  • 20
0

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

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

Anders
  • 97,548
  • 12
  • 110
  • 164
  • I want an autoupdate... If I run the install silent and then quit the app, then who will start up my app again ? because i cannot overwrite the files while i am already running them. There will be no user on that computer and all the stuff must be made automatically with no interaction required. – Adrian Pirvulescu Sep 01 '09 at 13:39
  • If you start it with foo.exe /Autoupdate /S /D=C:\Program Files\Foo and check in your installer for that parameter, you could tell that you need to restart the app – Anders Sep 01 '09 at 22:20
  • Can you maybe give a link to a resource where all command line options are listed? – Peter Smit Oct 13 '09 at 11:51
0

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

CJBrew
  • 2,720
  • 1
  • 20
  • 27