参考链接:http://strugglexl.iteye.com/blog/1489355
以下是根据例子,自己写的可以运行出来的空安装包,大家可以自己添加DLL然后生成自己的安装包。
RequestExecutionLevel user
!include "MUI.nsh"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "SimpChinese"
!define NAME "Draw.exe"
;自行修改自己的安装包ico
;Icon "D:/Draw.ico"
Section
SetOutPath $INSTDIR\${NAME}\bin
;修改自己EXE位置的快捷方式指向
CreateShortCut $DESKTOP\${NAME}.lnk $INSTDIR\${NAME}\bin\${NAME}.exe
SetShellVarContext All
;修改自己EXE位置的快捷方式指向
CreateShortCut $SMPROGRAMS\${NAME}.lnk $INSTDIR\${NAME}\bin\${NAME}.exe
WriteRegStr HKLM "Software\${NAME}" "" "$INSTDIR"
;在控制面板中可以有删除项
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "DisplayName" "${NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "UninstallString" '"$INSTDIR\${NAME}\uninst.exe"'
WriteUninstaller "$INSTDIR\${NAME}\uninst.exe"
SectionEnd
Section "Uninstall"
Delete $DESKTOP\${NAME}.lnk
SetShellVarContext All
Delete $SMPROGRAMS\${NAME}.lnk
DeleteRegKey HKLM "Software\${NAME}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
RMDir /r "$INSTDIR"
SectionEnd
;输出路径。可以自己修改
OutFile "D:/Draw.exe"

本文分享了如何利用NSIS脚本语言编写一个简单的安装包,并提供了可运行的空安装包示例,为读者提供了一个自定义DLL生成安装包的起点。
878

被折叠的 条评论
为什么被折叠?



