0
votes

I would like to make my installer silent. I would like to have flexibility to make installer silent or not depending on a command line option. In doc, I have found this to launch NSIS script compilation:

"C:\Program Files\NSIS\makensis.exe" "D:\Produts\folder\Install\nsis\MyApp.nsi"

this is working. By default, this is generating a non silent installer. To have a silent installer (with a command line option only), i tried this

"C:\Program Files\NSIS\makensis.exe" \S "D:\Produts\folder\Install\nsis\MyApp.nsi"

but \S is not a recognized option. How can i make installer silent with command line option?

I can find this in doc

4.8.1.36 SilentInstall

normal|silent|silentlog Specifies whether or not the installer should be silent. If it is 'silent' or 'silentlog', all sections that have the SF_SELECTED flag are installed quietly (you can set this flag using SectionSetFlags), with no screen output from the installer itself (the script can still display whatever it wants, use MessageBox's /SD to specify a default for silent installers). Note that if this is set to 'normal' and the user runs the installer with /S (case sensitive) on the command line, it will behave as if SilentInstall 'silent' was used. Note: see also LogSet.

See section 4.12 for more information.

so that i feel abused

Or should some instruction be added to NSIS script, so that compilation is receptive to /S option ?

Tried it with -S and not working either.

Thanks and regards

2

2 Answers

6
votes

/S option is available for your installer, not the makensis.exe. So you can run the installer in silent mode from commandline: MyApp.exe /S

In case you want to build installer to be always silent, you can use following technique:

In the .onInit function:

Function .onInit
  !ifdef IsSilent
    SetSilent silent
  !endif
FunctionEnd

And then build the installer with /D option to define the IsSilent constant:

makensis.exe /DIsSilent MyApp.nsi

That means, in case you build with /D option like above, the installer will be always silent; without /D option your installer will be non-silent by default and still you can run it from commandline MyApp.exe /S to be silent.

0
votes

If you want to COMPILE the NSI script silently from a command line, that is not the same as having the installer run silently.

In my compile batch scripts, I use:

c:\progra~1\nsis\makensis /V0 .\sample.nsi | findstr /b /r /c:"YouCantFindMe"

The /V# option suppresses all output but still includes a ribbon/banner when the compiler starts (see NSIS command line option documentation. Piping all output through "findstr" suppresses that output as well.