Nullsoft Scriptable Install System (NSIS) Installer - Quiet Mode

How do I make the Nullsoft Scriptable Install System (NSIS) installer disabled?

From Wikipedia:

"Nullsoft Scriptable Install System (NSIS), est un logiciel libre contrôlable par script, qui permet la création d'installateurs for the Windows. Nullsoft identification and creation of alternatives, la société créatrice de Winamp. NSIS est une alternative aux produits commerciaux, comme InstallShield ...

The NSIS makensis compiler program compiles scripts like the one below into executable installers. Each line in the script contains one command. "

# Example script

Name "Example1"
OutFile "example1.exe"
InstallDir "$PROGRAMFILES\Example1"
Page Directory
Page InstFiles
Section
  SetOutPath $INSTDIR
  File ..\makensis.exe
SectionEnd  

      

+3


source to share


1 answer


Using the command line

1. Using MakeNSIS

Compile NSIS (.nsi) script o generate installer

makensis [option | script.nsi | - [...]]

      

Example

makensis.exe myscript.nsi

      

2. Using the installer

Some parameters

  • / S silently launches the installer or uninstaller
  • / D sets the default installation directory ($ INSTDIR), overriding InstallDir and InstallerDirRegKey. It must be the last parameter used on the command line and must not contain quotes, even if the path contains spaces. Only absolute paths are supported.

Examples of

installer.exe /S

installer.exe /S /D=C:\Program Files\NSIS

      

Silent installers / uninstallers

  • To check if the installer is not working use IfSilent

  • To skip some of the instructions in silent mode (user interaction, window creation) use the jump command



Example

IfSilent +2 0 
    MessageBox MB_OK|MB_ICONINFORMATION 'This is a "non silent" installer'

      

This example displays the message box iif installer is not working. +2

means that the nex command is skipped if IfSilent is true. 0

means that the hat compiler should go to the next statement if IfSilent is false.

  • To install the installer in quiet mode (temporarily only), use SetSilent

    in .onInit

    . Options silent

    for silent mode and normal

    silent mode.

  • Install Installer | uninstaller silent, you can also use

    SilentInstall silent

    SilentUnInstall silent

  • In silent mode, all screens of the installer itself are not displayed. However, messages and all other screens not marked with SF_SELECTED can be displayed. To make the installer completely silent, use either a command jump (in general) or the / SD IDOK | IDCANCEL (for OK | CANCEL message boxes).

    MessageBox MB_OK|MB_ICONINFORMATION "This is not a silent installer" /SD IDOK

Here, if quiet mode is enabled, the message box is not displayed and behaves the same as with the OK user. Beware of the order of options there

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "Application is running. Please close it first." /SD IDCANCEL  IDOK OK IDCANCEL CANCEL 

      

  • If any information needs to be received from the user in silent mode, a few more parameters can be passed to the .onInit function with GetOptions.

like here:

!include FileFunc.nsh
!insertmacro GetParameters
!insertmacro GetOptions

Function .onInit
  ${GetParameters} $R0
  ClearErrors
  ${GetOptions} $R0 /USERNAME= $0
FunctionEnd

      

Links

NSIS silent install 1

NSIS silent install 2

NSIS silent install 3

+13


source







All Articles