Using NSIS to create an auto installer

NSIS (Nullsoft Scriptable Install System) is a professional open source system to create Windows installers. You can download NSIS from the main website HERE.

The Code Explained:

You will want to create a new text file with the nsi extension. The follwing is a breakdown of the script.

Here we want to include code to check if we are on x64 or x32

!include "x64.nsh"
!include "LogicLib.nsh"

Here we want to name our script and exe file

Name PythonInstaller
OutFile PythonInstaller

Lets setup the stype and permission level needed

XPStyle on
RequestExecutionLevel admin
ShowInstDetails show

Lets define our Section

Section "Install Python 2.7.6"
    IfFileExists C:\python27\python.exe WeAreGood WeAreBad
        DetailPrint "Already Installed: Skipping Python..."
        Goto Finished
      ${If} ${RunningX64}
          NSISdl::download "" $PLUGINSDIR\python.msi
          NSISdl::download "" $PLUGINSDIR\python.msi
      DetailPrint "Installing Python"
      nsExec::ExecToLog 'msiexec /i "$PLUGINSDIR\python.msi" /passive /quiet /norestart TARGETDIR=C:\Python27'
      Pop $0
      ${If} $0 != 0
          About "Failed to install Python: $0"

Compiling the nsi:

All that is left is to right click on the file and choose “Compile NSIS Script”

The Results:

You now have a script that will check if Python is install, if not it will download and then do a silent install.

Your Welcome!