NSIS Install File Script Explained

download the latest nsis

http://sourceforge.net/projects/nsis/files/latest/download?source=pdlp

Download the latest nisedit

http://sourceforge.jp/projects/sfnet_hmne/

 

Reference address:

http://blog.csdn.net/signjing/article/details/7855855

http://blog.csdn.net/signjing/article/details/7908808

http://blog.csdn.net/signjing/article/details/7944160

 

; Calendar.nsi

; This is the installation file script of a small software I use, which contains

; User installation directory selection, core program component and shortcut creation selection, uninstall program

;--------------------------------

; the installer name, which will be displayed in the installer dialog title

Name "Calendar 1900-2100"

; Generated single install executable

OutFile "Calendar-Setup.exe"

; default installation directory

InstallDir $PROGRAMFILES\Calendar1900-2100

; write the registry to indicate that the program is installed

InstallDirRegKey HKLM "Software\Calendar1900-2100" "Install_Dir"

;--------------------------------

; program window

; Install component content selection window

Page components

; install directory selection window

Page directory

; install file

Page instfiles

; Load Chinese interface resources, if there is no such sentence, the default is English interface

LoadLanguageFile "${NSISDIR}\Contrib\Language files\SimpChinese.nlf"

; Uninstaller Confirmation

UninstPage uninstConfirm

; 卸载内容

UninstPage instfiles

;--------------------------------

; 安装内容

Section "日历1900-2100","日历核心组件"

   SectionIn RO

  

   ; 设置安装目录.

   SetOutPath $INSTDIR

  

   ; 要打包安装的文件

   File "E:\Rookie\WinASM\Calendar\Release\Calendar.exe"

   File "E:\Rookie\WinASM\Calendar\Release\HBlibrary.dll"

   File /oname=$SYSDIR\hbhap.dll "E:\Rookie\WinASM\Calendar\Release\hbhap.dll"

   File "E:\Rookie\WinASM\Calendar\Release\distributer.txt"

  

   ; 写注册表

   WriteRegStr HKLM SOFTWARE\Calendar1900-2100 "Install_Dir" "$INSTDIR"

  

   ; 写卸载信息

   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Calendar1900-2100" "DisplayName" "日历1900-2100"

   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Calendar1900-2100" "UninstallString" '"$INSTDIR\uninstall.exe"'

   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Calendar1900-2100" "NoModify" 1

   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Calendar1900-2100" "NoRepair" 1

   WriteUninstaller "uninstall.exe"

  

SectionEnd

; Optional section (can be disabled by the user)

Section "开始菜单快捷方式"

   CreateDirectory "$SMPROGRAMS\Calendar1900-2100"

   CreateShortCut "$SMPROGRAMS\Calendar1900-2100\卸载.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0

   CreateShortCut "$SMPROGRAMS\Calendar1900-2100\日历1900-2100.lnk" "$INSTDIR\Calendar.exe" "" "$INSTDIR\Calendar.exe" 0

  

SectionEnd

;--------------------------------

; 卸载程序部分

Section "Uninstall"

  

   ; 删除注册表项

   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Calendar1900-2100"

   DeleteRegKey HKLM SOFTWARE\Calendar1900-2100

   ; 删除相关文件

   Delete $INSTDIR\Calendar.exe

   Delete $INSTDIR\distributer.txt

   Delete $INSTDIR\HBlibrary.dll

   Delete $SYSDIR\hbhap.dll

   ;Delete $INSTDIR\makensisw.exe

   Delete $INSTDIR\uninstall.exe

   ; 删除快捷方式

   Delete "$SMPROGRAMS\Calendar1900-2100\*.*"

   ; 删除程序目录

   RMDir "$SMPROGRAMS\Calendar1900-2100"

   RMDir "$INSTDIR"

SectionEnd

 

出处 : http://blog.163.com/pei_hua100/blog/static/80569759200923103537930/

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326676876&siteId=291194637