首页 > 代码库 > 使用NSIS (NullSoft Scriptable Install System)制作安装程序
使用NSIS (NullSoft Scriptable Install System)制作安装程序
Name "capture"
OutFile "capture.exe"
InstallDir "$PROGRAMFILES\capture"
Page directory
Page INSTFILES
UninstPage uninstConfirm
UninstPage instfiles
Var remote_zip_file
Var local_zip_file
Section ""
SetOutPath $INSTDIR
;Call DownloadVM
Call DownLoadImage
/*增加快捷方式到桌面和windows菜单*/
CreateDirectory "$SMPROGRAMS\capture\capture.exe"
CreateShortCut "$SMPROGRAMS\capture\capture.lnk" $INSTDIR\capture.exe
CreateShortCut "$DESKTOP\截图工具.lnk" $INSTDIR\capture.exe
Exec "$INSTDIR\capture.exe"
SetAutoClose true
/*增加卸载相关的模块*************************************
Section "Uninstall"
Delete "$INSTDIR\*.exe"
RMDir "$INSTDIR"
#快捷方式的删除
Delete "$SMPROGRAMS\capture\capture.lnk"
Delete "$DESKTOP\capture.lnk"
Delete "$SMPROGRAMS\capture\uninstall.lnk"
Sectionend
*/
/***************提供有uninstall.exe******************************************/
#CreateShortCut "$SMPROGRAMS\capture\uninstall.exe "$INSTDIR\uninstall.lnk"
#WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
;下载虚拟机
;下载映像
Function DownloadImage
StrCpy $remote_zip_file "http://lx.cdn.baidupcs.com/file/891b5d0cbcb36bfdfe1cf78e1b9a8606?bkt=p-f90fc2fcdb6bd141f37ee85d5dff6ef4&xcode=df2721f30e8b40d859c28ca7a3cf771bfef5f5d35a1b8d3d837047dfb5e85c39&fid=1277056680-250528-223982309163508&time=1415073762&sign=FDTAXERB-DCb740ccc5511e5e8fedcff06b081203-BWh3U6%2BrJc7Jq%2FfqafcdbWT%2FwGI%3D&to=sc&fm=Bei,B,U,nc&sta_dx=1&sta_cs=17&sta_ft=exe&sta_ct=6&newver=1&newfm=1&flow_ver=3&expires=8h&rt=pr&r=488712453&mlogid=1177857759&vuk=1277056680&vbdid=425043010&ifn=capture.exe&fn=capture.exe"
StrCpy $local_zip_file "capture.exe"
Call DownloadFile
FunctionEnd
/*************************************************/
#函数名:DownloadFile
#参数:remote_zip_file 文件下载地址,local_zip_file 下载到本地的相对路径名
#返回值:无
#描述:将网络文件下载到指定的本地目录进行安装
/************************************************/
Function DownloadFile
NSISdl::download $remote_zip_file "$INSTDIR\$local_zip_file"
Pop $R0
StrCmp $R0 "success" download_ok
SetDetailsView show
DetailPrint "download failed:$R0"
Abort
download_ok:
DetailPrint "downdload $R0 ok"
FunctionEnd
OutFile "capture.exe"
InstallDir "$PROGRAMFILES\capture"
Page directory
Page INSTFILES
UninstPage uninstConfirm
UninstPage instfiles
Var remote_zip_file
Var local_zip_file
Section ""
SetOutPath $INSTDIR
;Call DownloadVM
Call DownLoadImage
/*增加快捷方式到桌面和windows菜单*/
CreateDirectory "$SMPROGRAMS\capture\capture.exe"
CreateShortCut "$SMPROGRAMS\capture\capture.lnk" $INSTDIR\capture.exe
CreateShortCut "$DESKTOP\截图工具.lnk" $INSTDIR\capture.exe
Exec "$INSTDIR\capture.exe"
SetAutoClose true
/*增加卸载相关的模块*************************************
Section "Uninstall"
Delete "$INSTDIR\*.exe"
RMDir "$INSTDIR"
#快捷方式的删除
Delete "$SMPROGRAMS\capture\capture.lnk"
Delete "$DESKTOP\capture.lnk"
Delete "$SMPROGRAMS\capture\uninstall.lnk"
Sectionend
*/
/***************提供有uninstall.exe******************************************/
#CreateShortCut "$SMPROGRAMS\capture\uninstall.exe "$INSTDIR\uninstall.lnk"
#WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
;下载虚拟机
;下载映像
Function DownloadImage
StrCpy $remote_zip_file "http://lx.cdn.baidupcs.com/file/891b5d0cbcb36bfdfe1cf78e1b9a8606?bkt=p-f90fc2fcdb6bd141f37ee85d5dff6ef4&xcode=df2721f30e8b40d859c28ca7a3cf771bfef5f5d35a1b8d3d837047dfb5e85c39&fid=1277056680-250528-223982309163508&time=1415073762&sign=FDTAXERB-DCb740ccc5511e5e8fedcff06b081203-BWh3U6%2BrJc7Jq%2FfqafcdbWT%2FwGI%3D&to=sc&fm=Bei,B,U,nc&sta_dx=1&sta_cs=17&sta_ft=exe&sta_ct=6&newver=1&newfm=1&flow_ver=3&expires=8h&rt=pr&r=488712453&mlogid=1177857759&vuk=1277056680&vbdid=425043010&ifn=capture.exe&fn=capture.exe"
StrCpy $local_zip_file "capture.exe"
Call DownloadFile
FunctionEnd
/*************************************************/
#函数名:DownloadFile
#参数:remote_zip_file 文件下载地址,local_zip_file 下载到本地的相对路径名
#返回值:无
#描述:将网络文件下载到指定的本地目录进行安装
/************************************************/
Function DownloadFile
NSISdl::download $remote_zip_file "$INSTDIR\$local_zip_file"
Pop $R0
StrCmp $R0 "success" download_ok
SetDetailsView show
DetailPrint "download failed:$R0"
Abort
download_ok:
DetailPrint "downdload $R0 ok"
FunctionEnd
使用NSIS (NullSoft Scriptable Install System)制作安装程序
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。