Creating an Installer Using NSIS (II)

After playing for a few days with NSIS I have manage to create a full features installer which perform all the actions I needed. These are the following:

  • Download files
  • Unzip Files to a specific folder
  • Execute external installers
  • Modify Environment Variables

Since NSIS supports plug-ins there are quite a few available which provide extra functionalities such as the unzipping one.

Before going into these extra features, which will be subject of a new post, I prefer writing down how a more complex script is structure, just to keep in to the future.

NSIS is structured in pages (page == panels show each time a “next button” is clicked), most of them are predefined, where you can only change tittle or add extra text in them. Following are the pages definition using the MUI2 interface:

!insertmacro MUI_PAGE_LICENSE “path\to\license.txt”




Except for the components page which is configured using the section described in the previous post.  Each Section name will appear as a component with its corresponding checkbox, groups can also be specified and the code inside each section will be only executed if the component is checked:

SectionGroup “Extra Plug-ins”

Section “Spreadsheet”


Section “PDF”



!insertmacro MUI_PAGE_LICENSE “${NSISDIR}\Docs\Modern UI\License.txt”


A section declared as follows is executed always :

Section “”


The next chunk of code creates an entry in the program’s menu:

CreateDirectory “$SMPROGRAMS\Advansen\”

CreateShortCut “$SMPROGRAMS\Advansen\uninstall.lnk” “$INSTDIR\uninstall.exe”

And in order to execute external installers or additional programs the ExecWait sentences provides an easy way to achive that. In the next line python uninstaller is called with the quite flag so no window pops up:

ExecWait ¬†‘”msiexec” /uninstall “$INSTDIR\python-2.6.2.msi” /quiet’