- NSIS Discussion
- Silent Installer Return
Archive: Silent Installer Return
Zilatica
16th March 2010 23:10 UTC
Silent Installer Return
Is there a way to make a silent install block until completed and return a value? For example, I want to silently run my install from the command line (batch file) and return 0 for success and 1 or more to represent a failure.
Is this possible?
Animaether
16th March 2010 23:32 UTC
Whether your installer 'blocks' until completed depends on your batch file method. By default, it should wait for your installer to exit.
( There are some batch utilities that let you run a program and continue with the batch process even while that program is still running - you'd have to look into their documentation on how to stop this ).
To set a return value, see the SetErrorLevel instruction.
Afrow UK
18th March 2010 23:48 UTC
Use start /wait
Stu
Zilatica
4th May 2010 23:05 UTC
I'm calling the uninstaller.exe silently from another installer, both generated from nsis. I call the uninstaller.exe using ExecWait, but ExecWait doesn't block (or rather I don't think the uninstaller blocks).
To verify this I added a sleep command for 1 minute. Then on the installer I wrapped the Exec wait call with message boxes and they happen one right after the other, with no 1 minute delay. I verified the uninstaller indeed blocks for one minute even silently by calling it from the command line. The files it is uninstalling get removed after about a minute.
So, again, can you explain how to make a silent uninstaller block until it completes executing? Are there some make nsis flags I have to pass, or perhaps a directive at the top of my script?
Thanks,
Zach
Zilatica
4th May 2010 23:07 UTC
Eh, I don't mean the uninstaller blocks, I mean there is a 1 minute delay after calling the uninstaller before the side effects (files removed) happen.
The uninstaller has the 1 minute delay before performing actions, but the installer's "ExecWait" which calls upon this uninstaller doesn't wait for this 1 minute delay, meaning the execwait isn't blocking until completion of the uninstaller.
I need this for an upgrade sequence I'm writing. Basically, I install version 1.0.0, then I want to run installer for 1.0.1 which will run the uninstaller of 1.0.0 with flags passed to leave the data intact, followed by installing the 1.0.1 files.
Can you help?
Zilatica
4th May 2010 23:14 UTC
I also read from the NSIS.chm (D.1 Error Levels):
Note that uninstallers copy themselves to the temporary directory and execute from there so the original uninstaller can be deleted. This means the error level the uninstaller sets is not available to the executing process, unless it simulates this copy process and executes the copied uninstaller.
So, the uninstaller may not be blocking because it is being copied and then executed as a spawned process executing from another location. Can I, myself, call this extraction and manage it so that I can achieve the blocking behavior?
Zilatica
5th May 2010 14:35 UTC
You sir, are the shiznit.
Zilatica
5th May 2010 22:35 UTC
So, one last quick question. Is there a way to do the same thing with the installer.exe? The /D="path" for installer doesn't do it and neither does the _?="path"
Basically, you know of a page that you can point me to that will tell me how to make the ExecWait block for the installer?
Afrow UK
5th May 2010 23:25 UTC
It does block unless the installer you are launching has been scripted to do otherwise (i.e. launch another process). It is only the uninstaller that does this by default (by copying itself to a temp folder and re-executing itself from there).
Stu