接上文:http://blog.csdn.net/shallen320/article/details/44915649
上文介绍了如何查找Qt程序依耐性,如何利用NSIS 和 .zip文件制作简单的压缩包。上文所用的方法制作的安装包十分简单,连创建桌面快捷方式都没有。本文介绍如何使用NSIS脚本语言制作一个略微复杂的安装包。
下面是我使用的NSIS脚本语言范例,含有简单全面的功能,包括:
- 设置安装文件版本,公司,版权信息
- 安装拷贝指定文件
- 创建开始菜单,桌面快捷方式
- 创建卸载程序,并能在windows控制面板添加删除程序里卸载程序
脚本语言如下,程序名为Terminal:
; Terminal.nsi
;
; This script is based on example2.nsi,
; has uninstall support and (optionally) installs start menu shortcuts.
;
; It will install Terminal.nsi into a directory that the user selects,
;--------------------------------
; The name of the installer
Name "Terminal"
; The file to write
OutFile "Installer\TerminalInstaller.exe"
; The default installation directory
InstallDir C:\Terminal
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\NSIS_Terminal" "Install_Dir"
; Request application privileges for Windows Vista
RequestExec