杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1806|回复: 0

NSIS 一个完整的软件安装脚本演示

[复制链接]
发表于 2016-5-21 14:42:57 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. ;Author: tinyms
  2. ;Date: 2011-06-22
  3. ;usage: replace NSIS/Contrib/zip2exe/Modern.nsh
  4. ;RequestExecutionLevel none|user|highest|admin

  5. ;RequestExecutionLevel user

  6. !include "MUI.nsh"
  7. !insertmacro MUI_PAGE_DIRECTORY
  8. !insertmacro MUI_PAGE_INSTFILES
  9. !insertmacro MUI_LANGUAGE "SimpChinese"

  10. !define NAME "你的Exe名称"
  11. ;自行修改自己的安装包ico
  12. Icon "D:/logo.ico"

  13. Section
  14.     SetOutPath $INSTDIR\${NAME}\bin
  15.         ;修改自己Exe位置的快捷方式指向
  16.     CreateShortCut $DESKTOP\${NAME}.lnk $INSTDIR\${NAME}\bin\${NAME}.exe
  17.     SetShellVarContext All
  18.         ;修改自己Exe位置的快捷方式指向
  19.     CreateShortCut $SMPROGRAMS\${NAME}.lnk $INSTDIR\${NAME}\bin\${NAME}.exe
  20.     WriteRegStr HKLM "Software\${NAME}" "" "$INSTDIR"
  21.         ;在控制面板中可以有删除项
  22.     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "DisplayName" "${NAME}"
  23.     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "UninstallString" '"$INSTDIR\${NAME}\uninst.exe"'
  24.     WriteUninstaller "$INSTDIR\${NAME}\uninst.exe"
  25. SectionEnd

  26. Section "Uninstall"
  27.     Delete $DESKTOP\${NAME}.lnk
  28.     SetShellVarContext All
  29.     Delete $SMPROGRAMS\${NAME}.lnk
  30.     DeleteRegKey HKLM "Software\${NAME}"
  31.     DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
  32.     RMDir /r "$INSTDIR"
  33. SectionEnd
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-5-15 18:49 , Processed in 0.124716 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表