开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 4500|回复: 0

NSIS自动封装.net3.5安装文件脚本源码

[复制链接]

0

精华

0

贡献

18

赞扬

帖子
43
软币
239
在线时间
17 小时
注册时间
2014-4-18
发表于 2015-8-4 13:42:56 | 显示全部楼层 |阅读模式
!system '>tmp set/p=MSCF<nul'
!packhdr temp.dat 'cmd /c Copy /b temp.dat /b +tmp&&del tmp'

!define MUI_UI "mrdc.res"
outfile "DotNetFx35.exe"
Name ".Net Framework 3.5 自动安装程序"
Caption ".Net 框架 3.5 自动安装程序"
InstallDir "$PROGRAMFILES\Dhc\Support\installer\DotNetFrameworks"
SetCompressor lzma
SetDatablockOptimize on
Icon "DotNetFx35.ico"
BrandingText " "
Page instfiles
CRCCheck off
xpstyle on
ShowInstDetails nevershow
!include "MUI.nsh"
!define MUI_ICON "DotNetFx35.ico"
!insertmacro MUI_LANGUAGE "SimpChinese"
VIProductVersion 3.5.0.0
VIAddVersionKey /LANG=2052  "FileVersion" "版本: 3.5$\r$\n发布人: liuz"
VIAddVersionKey /LANG=2052  "ProductName"  ".Net Framework 3.5 自动安装程序"
VIAddVersionKey /LANG=2052  "CompanyName" "Hesung Studio"
VIAddVersionKey /LANG=2052  "LegalTrademarks" "Hesung Studio"
VIAddVersionKey /LANG=2052  "LegalCopyright" "Hesung Studio"
VIAddVersionKey /LANG=2052  "FileDescription" ".net Framework 3.5 自动安装程序"
VIAddVersionKey /LANG=2052  "Comments" ".net Framework 3.5 自动安装程序"
Function .onInit
SYSTEM::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
IntCmp $0 0 0 _lab_exit

ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" "Install"
StrCmp $0 1 0 _lab_begin_prompt
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup" "InstallSuccess"
StrCmp $0 1 0 _lab_begin_prompt
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" "Install"
StrCmp $0 1 0 _lab_begin_prompt
MessageBox  MB_YESNO|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON "本机已经过安装.net Framework 3.5,是否进行更新安装?" /SD IDNO IDYES _lab_begin IDNO _lab_exit
_lab_begin_prompt:
MessageBox  MB_YESNO|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON "确定要安装.net Framework 3.5吗?" /SD IDYES IDNO _lab_exit
_lab_begin:
Banner::show /NOUNLOAD ".net 框架 3.5 自动安装程序"
Banner::getWindow /NOUNLOAD
Pop $R0
GetDlgItem $R9 $R0 1030
SendMessage $R9 ${WM_SETTEXT} 0 'STR:正在预处理.net框架3.5安装文件...'
SetOutPath $INSTDIR
;Sleep 5000
file /r "DotNetFrameworks\*"
SendMessage $R9 ${WM_SETTEXT} 0 'STR:正在安装.net框架3.5 请耐心等待...'
ExecWait '"$INSTDIR\dotNetFx35setup.exe" /q /norestart' $0
Banner::destroy
IntCmp $0 3010 0 _lab_exit
MessageBox  MB_YESNO|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON ".net 3.5 需要重启计算机才能完成安装,是否重启? " /SD IDNO IDNO _lab_exit
Reboot
_lab_exit:
quit
Functionend
Section ""
sectionend

DotNetFx35.zip

1.28 KB, 下载次数: 11

评分

参与人数 1赞扬 +1 收起 理由
goodworker + 1 赞一个

查看全部评分

回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-12-22 15:12

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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