NSIS: Bare Minimum to Get A Job Done


You don’t need to install NSIS, but rather just download a zip of a version you like and add to system PATH. The main .exe is makensis.exe.

Best way for no-hassle development is using VS Code Extension (make sure makensis.exe is in your system path for this to work).

Basic Installer

# how the output file should be named?
OutFile "bt-installer.exe"

# define string to reuse
!define MUI_PRODUCT "Browser Tamer"

# not sure, just make it look slightly better in terms of DPI
ManifestDPIAware false

# SetCompressor zlib|bzip2|lzma
# LZMA seems to have best compression
SetCompressor lzma

# Where would it get installed?

    SetOutPath $INSTDIR

    File "..\out\release\bt\bt.exe"

    CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}.lnk" "$INSTDIR\bt.exe"

    WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT}"
    WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\uninstall.exe"

    WriteUninstaller "$INSTDIR\uninstall.exe"

Section "uninstall"
    RMDir /r "$INSTDIR\*.*"
    RMDir "$INSTDIR"

    Delete "$SMPROGRAMS\Browser Tamer.lnk"

    DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"  

    Delete "$INSTDIR\uninstall.exe"

To contact me, send an email anytime or leave a comment below.