官网
我的一份范本:
(DevelopApps下找到)
用于软件安装及卸载。
稍后我会发一份本程序基本指令介绍,不会太长。
官网
我的一份范本:
(DevelopApps下找到)
用于软件安装及卸载。
稍后我会发一份本程序基本指令介绍,不会太长。
; The name of the installer
Name "test"
; The file to write
OutFile "in.exe"
XPStyle on
!include "WinVer.nsh"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\SimpChinese.nlf"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\TradChinese.nlf"
;--------------------------------
;Version Information
VIProductVersion "1.0.0.0"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "test"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "test"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "test"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" ""
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" ""
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "test"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.0.0"
;--------------------------------
; The default installation directory
InstallDir $PROGRAMFILES\test
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\test" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Pages
Page license
licensedata license
; license
Page directory
Page components
Page instfiles
ShowInstDetails show
;UninstPage uninstConfirm
UninstPage instfiles
ShowUninstDetails show
Name:项目名称。会显示在主程序标题栏。
Outfile:输出程序包名称。我选择in.exe,则成品如下:
Function:程序段。
.oninit:启动第一任务区。
.onInstSuccess:成功安装后。
.onInstFailed:不成功安装后。
un.onUninstSuccess:成功卸载后。
un.onUninstFailed:不成功卸载后。
FunctionEnd:结束程序段。
Section,SectionEnd:安装主体。加!表示必选。
SetAutoClose true/false:窗口安装完后是否自动关闭。自行选择。
接下来从${if}到${endif}有一套版本判断语句,不用就删了。
Messagebox:通知框。
SetSilent:静默安装。
HideWindow:隐藏silent/显示normal主程序窗口。
SectionIn RO意义不明,已忘记。
SetOutPath $INSTDIR设安装目录。
File写文件。
Exec执行。
DetailPrint输出文本。
WriteUninstaller制作卸载程序。
WriteReg与注册表,Windows机制有关,我了解不多。DeleteRegKey也如此。
CreateDirectory建目录。
CreateShortcut建快捷方式。
Delete删文件。
RMDir删目录。
Abort输出信息并中断。
goto,IfErrors,IfAbort用于程序跳转。
如此。
(我查了一下,SectionIn应该起到了作用,请各位自己研究吧。以上。)