Abort NSIS silent installer - installation

I've created an NSIS installer that installs a certain program. Everything works fine but I wonder if it is possible to abort the installation when it runs in silent mode.
So is there a way to abort an installation when I install an NSIS installer via the command line with this command: installer.exe /S /D=Path/To/Directory?
I tried to abort it via CTRL+C as it works for other programs, too, but that didn't work.

NSIS is not a console program so it is not going to respond to console keyboard shortcuts.
Even if you could trick it into behaving like a console program when started silent it is not going to work in a stable manner because CTRL+C will just kill the process unless the program has added extra code to handle the aborting events...

Related

Installing Windows Service fails when command run in batch file

I'm converting a legacy VC 6 C++ Windows Service application to Visual Studio 2022
The conversion is completed and, if I open a CMD prompt with Admin rights, I can install the service using this command:
Service.exe /Install
It installs instantly and starts correctly.
However, I need to install it within an installation script, which loads a bunch of services by calling a batch file which contains the commands to start them. It is run with elevated permissions. However, which it reaches the above line (Service.exe /Install) it hangs. There is no error message and I cannot even terminate it using CTRL + C. The only way around it is to close the CMD prompt. The service is not installed.
My service does not appear in the Task manager's list of processes when the batch file hangs.
I've tried adding the full path to the service in the batch file but it makes no difference. Running this batch file from an elevated command prompt (rather than the installer script) runs into the same problem.
I'm tearing my hair out over this (almost bald now :-)) - can anyone provide any suggestions?
Thanks
Andy
Debugging found a logic error in the start up code.
Basically, calling Service.exe /Install directly from the command line just passes "Service.exe /Install" as the command line, whereas calling it from a batch file / CreateProcess() passes the whole path to the service in the command line and the parser was not taking that into account. Maybe it behaved differently in older Windows versions, but the parser was really badly written.
I'm glad it was me who wrote it :-)

Nuget.exe crashes when invoked from cmd.exe

I'm trying to automatically download Nuget.exe from a Rakefile, in order to minimize the amount of initial setup needed to run my samples on GitHub.
I've understand how to download a file (I'm using HTTParty) and how to save a binary file (using the b flag on File.new) but now I've got problem running Nuget.exe. In particular:
if I launch it directly or from PowerShell, the executable runs fine;
if I launch it from cmd or from a Rakefile (which in turn runs cmd), Windows tells me that the program "stopped working".
I reproduced the same behavior with the Nuget bootstrapper, so I thought that the cause was some configuration in my computer.
It then occured to me that I installed ansicom, a library to handle ANSI sequences. I disabled it and then Nuget started without any problem.

installing Cygwin 1.7.15-1 on Win 7

I downloaded and ran setup, and it seemed to completed normally, but after it completed I didn't have cygwin in my startup menu or a shortcut on my desktop, both of which I selected. The C:\cygwin does exist, with subdirectories under it. I execute c:\cygwin\bin\xterm. It flashed on the screen with an error message, but it was too quick to read. I have run cygwin before on XP without problems, but this is the first time with Win 7.
Is there some background process that needs to be running for cygwin to work? I am wondering if the installation is OK, but I am just missing the startup menu entry or desktop icon which starts a background process, or is there some path or registry entry I need to make.
The problem was I didn't install as administrator. When I went back and re-installed as administrator, everything worked fine.

Pipe Nsis installer log to console druing the silent install

Is it posible to pipe Nsis installer log to console druing the silent install. Installer is third party so I can't change it. Thanks in advance.
NSIS is a GUI app and does not really support output to the console.
There are two ways to get console output:
Recompile NSIS with logging to console turned on (NSIS_CONFIG_LOG_STDOUT)
Call AllocConsole with the system plugin and print custom output
Both of these require changes to the installer so it can only be done by the author of the installer...

Suppress the reboot prompt for the .NET 3.5 SP1 redist

I have an InstallShield 2009 Basic MSI project that I've modified to load the 3.5 SP1 redistributable for the .NET framework. It loads fine but as soon as it finishes it displays a prompt saying the system has to reboot, and you can either say yes and it will reboot, or no and it will stop the install.
I then went in and edited the .NET Framework 3.5 Service Pack 1 (Web Download) redistributable using InstallShield's prerequisite editor. I changed the behavior if it needs a reboot to 'Note it, fail to resume if the machine is rebooted, and reboot after the installation'. I interpreted that as meaning the reboot prompt would not be shown until the end of the install, but it still showed up in the same place.
Is there a way to suppress the prompt until the end of the install? Do I need to pick a different option from that drop-down in the pre-req editor?
Bonus question: if I need to run my install unattended, is there a way to automatically have it reboot after the entire install is finished if one is needed?
EDIT:
The command switches mentioned below would probably work, but in the case of running the install unattended it will be launched from another program, and I really don't want to modify that app just for this one case. Here's a better question: is a reboot really required after installing .NET 3.5 SP1, or is it one of those things where a reboot would be good but is not absolutely needed for programs to start using the 3.5 framework?
If you type msiexec /? in the Start -> Run box, you'll get a screen with command line options for the MSI runtime, including the following:
Restart Options
/norestart
Do not restart after the installation is complete
/promptrestart
Prompts the user for restart if necessary
/forcerestart
Always restart the computer after installation
You can suppress the reboot prompt entirely by adding the following to the MSI's setup command line:
REBOOT=ReallySuppress
But then it won't prompt at the end of your complete install, as it sounds like you were hoping for; you're just stopping the prompting altogether.
As for your additional question, you can force a reboot with the following switch:
REBOOT=Force REBOOTPROMPT=Supress
Here you're telling the Windows Installer to prompt for a reboot always, and then suppressing the prompt so it just happens.

Resources