Each NSIS installer contains one or more Sections. Each These sections are created, modified, and ended with the following commands.
size_kb
Tells the installer that the current section needs an additional "size_kb" kilobytes of disk space. Only valid within a section (will have no effect outside of a section or in a function).
[/o] [([!]|[-])section_name] [section index output]
Begins and opens a new section. If section_name is empty, omitted, or begins with a -, then it is a hidden section and the user will not have the option of disabling it. If the section name is 'Uninstall' or is prefixed with 'un.', then it is a an uninstaller section. If section index output is specified, the parameter will be !defined with the section index (that can be used for SectionSetText etc). If the section name begins with a !, the section will be displayed as bold. If the /o switch is specified, the section will be unselected by default.
This command closes the current open section.
insttype_index [insttype_index] [RO]
This command specifies which install types (see InstType) the current section defaults to the enabled state in. Multiple SectionIn commands can be specified (they are combined). If you specify RO as a parameter, then the section will be read-only, meaning the user won't be able to change its state.
[/e] Caption [subsection_name index output]
This command inserts a subsection. The subsection must be closed with SubSectionEnd, and should contain 1 or more Sections. If the subsection name begins with a !, the subsection will be displayed as bold. If /e is present, the sub sections of the sub section will be expanded by default. If section index output is specified, the parameter will be !defined with the section index (that can be used for SectionSetText etc). If the name is prefixed with 'un.' the subsection is an uninstaller subsection.
Closes a subsection opened with SubSection.
A special Section named 'Uninstall' must be created in order to generate an uninstaller. This section should remove all files, registry keys etc etc that were installed by the installer, from the system. Here is an example of a simple uninstall section:
Section "Uninstall" Delete $INSTDIR\Uninst.exe ; delete self (see explanation below why this works) Delete $INSTDIR\myApp.exe RMDir $INSTDIR DeleteRegKey HKLM SOFTWARE\myApp SectionEnd
The first Delete instruction works (deleting the uninstaller), because the uninstaller is transparently copied to the system temporary directory for the uninstall.