Archive: How to wait for NSIS-created installer to complete in silent mode?


How to wait for NSIS-created installer to complete in silent mode?
Hi NSIS developers,

When running an NSIS-created installer in silent mode from the command line, I have found that the shell will return immediately, while the installer continues to run in a separate process.

Do you know how I can configure my NSIS-created installer so that completion of the install process will be waitable by the shell? The use case here is a third-party scripting system that needs to consume my installer in a way that waits for my installer process to complete before starting the next task. My installer is expected to run in silent mode and then return when it is fully complete.

I have noted another problem with the SilentInstall command. Perhaps this is related. Setting "SilentInstall silent" does not seem to have any effect. If I call my installer on the command line with "/S" it does launch a silent mode install.

Do any of you superpimps have advice on how to do this? Or if the answer is just 'no,' then I will groan and go ahead with switching to MSI (oh god MS toolchain why why).


In command prompt/batch files one must use start /wait for non console apps. In C/C++ you'd use WaitForSingleObject() on the process handle and in .NET you'd use process.Wait*****it(). I think you must be mistaken with your findings.

Stu


Thanks for the advice, Stu.

I was not able to get the desired wait behavior with the following bat file. Do you have any idea what might be wrong?

I created a bat file containing the following text:

@echo off
start "Installer" /wait /B "Installer.exe" /S

I then executed the batch file from a cmd.exe prompt. The command prompt still immediately returns from executing the script, while the installer runs in a detached process.

If I omit the /S, then it waits for the GUI installer to complete, the same as if I executed the installer directly from a command prompt. But the goal of this exercise is to wait for the silent-mode installer to complete. Any ideas?


Using /B stops that code working at all as NSIS installers aren't console applications. Either way, with or without /S (and without /B) it waits for me. It never waits when run directly without using start /wait for me.

Stu


Ah, excellent! Removing /B did the trick. Thank you!