当前位置: 首页 > news >正文

有网站源码去哪里做郑州seo技术培训班

有网站源码去哪里做,郑州seo技术培训班,沈阳网站建设渠道,国外企业建站引言 NSIS (Nullsoft Scriptable Install System) 是一个专业开源的制作 windows 安装程序的工具。我们通过HM NSIEDIT编写好脚本、编译即可生成exe安装包。安装过程中可以配置其安装包图标、名称、出版人、网站等。此外,还可以设置程序开机自启动、管理员权限运行…

引言

NSIS (Nullsoft Scriptable Install System) 是一个专业开源的制作 windows 安装程序的工具。我们通过HM NSIEDIT编写好脚本、编译即可生成exe安装包。安装过程中可以配置其安装包图标、名称、出版人、网站等。此外,还可以设置程序开机自启动、管理员权限运行等给基于注册表的操作,也可以运行批处理文件(bat文件)进行系统模块的安装。

1、所需工具

1:NSIS 下载地址: NSIS: Nullsoft Scriptable Install System download | SourceForge.net

2:HM NIS Edit 脚本编辑工具:HM NIS Edit: A Free NSIS Editor/IDE (sourceforge.net)

2、示例

关于NSIS网上有很多教程,不在此赘述。我将主要记录在使用过程中出现的问题和一些常用的语法等。

2.1、设置安装完运行、开机自启动

!insertmacro MUI_PAGE_FINISH 上方插入代码:

//是否安装完运行勾选框
!define MUI_FINISHPAGE_RUN "$INSTDIR\net48\MetalBurrDetectionSys.exe"
//开机自启动勾选框
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_Function AutoBoot
!define MUI_FINISHPAGE_SHOWREADME_TEXT "开机自启动"
Function AutoBootWriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "MetalBurrKey" '"$INSTDIR\net48\MetalBurrDetectionSys.exe"'
FunctionEnd

 记得在卸载时删除键值

Function un.onUninstSuccessHideWindowDeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "MetalBurrKey"MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
FunctionEnd

2.2、打包文件匹配

利用脚本向导会帮助我们快速构建打包程序,但是文件罗列的太过详细,有事我们只需要打包Debug文件夹中 dll 和 exe 文件即可,而且后续可能会增加或修改类库和运行程序的名称,此时用文件名匹配更为合适。

SetOutPath "$INSTDIR"SetOverwrite ifnewerFile  "software\bin\Debug\*.dll"File  "software\bin\Debug\*.exe"

如果你想包含子目录及其所有指定格式文件,如下

SetOutPath "$INSTDIR"SetOverwrite ifnewerFile -r "software\bin\Debug\*.dll"File -r "software\bin\Debug\*.exe"

 删除文件也有类似的方法:

RMDir /r "$INSTDIR\net48"
RMDir /r "$INSTDIR"

2.3、注册表操作、管理员启动

在Post阶段,向导会为我们自动生成程序相关键值,我们也可以根据需要插入额外键值 ,如需要管理员启动

Section -PostWriteUninstaller "$INSTDIR\uninst.exe"WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\net48\MetalBurrDetectionSys.exe"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\net48\MetalBurrDetectionSys.exe"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}";针对当前用户有效WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\net48\MetalBurrDetectionSys.exe" "RUNASADMIN";针对所有用户有效WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\net48\MetalBurrDetectionSys.exe" "RUNASADMIN"
SectionEnd

管理员启动设计如下代码:

   ;针对当前用户有效WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\net48\MetalBurrDetectionSys.exe" "RUNASADMIN";针对所有用户有效WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\net48\MetalBurrDetectionSys.exe" 

2.4、快捷键

我在使用生成快捷键时,会出现点击快捷键无效,或则在开始菜单里没有生成对应的目录和快捷键,并且快捷键也无效的情况,当我把程序的主运行exe放在最后写入时即可解决。

 生成桌面快捷键、开始菜单目录及程序和卸载快捷键代码如下:

Section -AdditionalIcons!insertmacro MUI_STARTMENU_WRITE_BEGIN ApplicationCreateDirectory "$SMPROGRAMS\$ICONS_GROUP"CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\net48\MetalBurrDetectionSys.exe"CreateShortCut "$DESKTOP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\net48\MetalBurrDetectionSys.exe"CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

2.5、执行bat脚本

我主要用到两种:等待并显示终端、等待不显示终端

;等待不显示终端
nsExec::Exec '$INSTDIR/removeWeb.bat'
;等待并显示终端
ExecWait '$INSTDIR/removeWeb.bat'

2.6、完整示例

; Script generated by the HM NIS Edit Script Wizard.; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "某某软件"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "某某公司"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\MetalBurrDetectionSys.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"; MUI 1.67 compatible ------
!include "MUI.nsh"; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "某某软件\Resources\maociLOGO.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "softwarelicense.rtf"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "某某软件"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\net48\MetalBurrDetectionSys.exe"
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_Function AutoBoot
!define MUI_FINISHPAGE_SHOWREADME_TEXT "开机自启动"
!insertmacro MUI_PAGE_FINISH; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES; Language files
!insertmacro MUI_LANGUAGE "SimpChinese"; MUI end ------Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}安装包 ${PRODUCT_VERSION}.exe"
InstallDir "D:\Program Files\某某软件"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails showRequestExecutionLevel admin;打包帮助文档
Section "Helpbook" SEC01;执行脚本nsExec::Exec '$INSTDIR/removeWeb.bat'SetOutPath "D:\HelpFile\某某软件\dist"File /r "..\EditorRunHelpFile\BatteryHelpFile\docs\.vuepress\dist\*.*"nsExec::Exec '$INSTDIR/iis.bat'
SectionEnd;打包主程序文件
Section "MainSection" SEC02;停止进程nsExec::Exec "taskkill /im MetalBurrDetectionSys.exe /f"SetOutPath "$INSTDIR\SystemConfig"SetOverwrite ifnewerFile /r "某某软件\bin\Debug\SystemConfig\*.json"SetOutPath "$INSTDIR"SetOverwrite ifnewerFile  "某某软件\bin\Debug\*.*"SetOutPath "$INSTDIR\net48"SetOverwrite ifnewerFile /r "某某软件\bin\Debug\net48\*.dll"File /r "某某软件\bin\Debug\net48\*.json"File /r "某某软件\bin\Debug\net48\*.config"File /r "某某软件\bin\Debug\net48\*.WH"File /r "某某软件\bin\Debug\net48\*.png"File "A:\目录\*.dll"File /r "某某软件\bin\Debug\net48\*.exe"SectionEndSection -PostWriteUninstaller "$INSTDIR\uninst.exe"WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\net48\MetalBurrDetectionSys.exe"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\net48\MetalBurrDetectionSys.exe"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}";管理员启动;针对当前用户有效WriteRegStr HKCU "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\net48\MetalBurrDetectionSys.exe" "RUNASADMIN";针对所有用户有效WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\net48\MetalBurrDetectionSys.exe" "RUNASADMIN"
SectionEnd;快捷键
Section -AdditionalIcons!insertmacro MUI_STARTMENU_WRITE_BEGIN ApplicationCreateDirectory "$SMPROGRAMS\$ICONS_GROUP"CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\net48\MetalBurrDetectionSys.exe"CreateShortCut "$DESKTOP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\net48\MetalBurrDetectionSys.exe"CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"!insertmacro MUI_STARTMENU_WRITE_END
SectionEndSection Uninstall!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP;执行脚本 等待不显示终端nsExec::Exec '$INSTDIR/removeWeb.bat'Delete "$INSTDIR\uninst.exe"Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"Delete "$DESKTOP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk"Delete "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk"RMDir "$SMPROGRAMS\$ICONS_GROUP"RMDir /r "D:\HelpFile\某某软件\dist"RMDir /r "$INSTDIR\SystemConfig"RMDir /r "$INSTDIR\net48"RMDir /r "$INSTDIR"DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "MetalBurrKey"SetAutoClose true
SectionEnd;函数放在最后
Function AutoBootWriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "MetalBurrKey" '"$INSTDIR\net48\MetalBurrDetectionSys.exe"'
FunctionEndFunction un.onUninstSuccessHideWindowDeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "MetalBurrKey"MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
FunctionEndFunction un.onInitMessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,其及所有的组件?" IDYES +2Abort
FunctionEnd

3、脚本

自动安装IIS服务

@echo off
cd /d "%~dp0"echo Installing IIS...
echo Wait a moment...
start /w pkgmgr /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPIecho Done.

删除网站

@echo off
setlocal:: 设置网站名称
set SITE_NAME=WH_MetalBurr:: 使用appcmd.exe删除网站
%windir%\system32\inetsrv\appcmd delete site %SITE_NAME%endlocal
echo Done.


文章转载自:
http://dinncomouthpart.ssfq.cn
http://dinncojavan.ssfq.cn
http://dinncoagglutinogenic.ssfq.cn
http://dinncogodly.ssfq.cn
http://dinncoarts.ssfq.cn
http://dinncoafterimage.ssfq.cn
http://dinncohypothyroid.ssfq.cn
http://dinncodissemblance.ssfq.cn
http://dinncovalkyr.ssfq.cn
http://dinncotriteness.ssfq.cn
http://dinncomicrofilm.ssfq.cn
http://dinncoplatinate.ssfq.cn
http://dinncojuncaceous.ssfq.cn
http://dinncohysterology.ssfq.cn
http://dinncoexcommunication.ssfq.cn
http://dinncointerminable.ssfq.cn
http://dinncolancinating.ssfq.cn
http://dinncointerpreter.ssfq.cn
http://dinncochimb.ssfq.cn
http://dinncostepfather.ssfq.cn
http://dinncothermopenetration.ssfq.cn
http://dinncodeciliter.ssfq.cn
http://dinncodepartmentalise.ssfq.cn
http://dinncofanatically.ssfq.cn
http://dinncosept.ssfq.cn
http://dinncovestment.ssfq.cn
http://dinncodye.ssfq.cn
http://dinncoovation.ssfq.cn
http://dinncodisintermediate.ssfq.cn
http://dinncotamanoir.ssfq.cn
http://dinncoprivatdozent.ssfq.cn
http://dinncohellgrammite.ssfq.cn
http://dinncoimpropriator.ssfq.cn
http://dinncofgcm.ssfq.cn
http://dinncolubumbashi.ssfq.cn
http://dinncotroffer.ssfq.cn
http://dinncogranadilla.ssfq.cn
http://dinncofacia.ssfq.cn
http://dinncoosteotome.ssfq.cn
http://dinncoamericanize.ssfq.cn
http://dinncoconcinnate.ssfq.cn
http://dinncocamisado.ssfq.cn
http://dinncopilose.ssfq.cn
http://dinncocambodia.ssfq.cn
http://dinncofattypuff.ssfq.cn
http://dinncoyugoslavic.ssfq.cn
http://dinncoperfidiously.ssfq.cn
http://dinncoawmous.ssfq.cn
http://dinncopaedology.ssfq.cn
http://dinncoautocephalous.ssfq.cn
http://dinncodictaphone.ssfq.cn
http://dinnconosewing.ssfq.cn
http://dinncochace.ssfq.cn
http://dinncobookkeeping.ssfq.cn
http://dinncocentrum.ssfq.cn
http://dinncoboathouse.ssfq.cn
http://dinncocommuterdom.ssfq.cn
http://dinncoforamen.ssfq.cn
http://dinncofermentable.ssfq.cn
http://dinncoroboticist.ssfq.cn
http://dinncolactonization.ssfq.cn
http://dinncocircumferential.ssfq.cn
http://dinncoadonize.ssfq.cn
http://dinncosamel.ssfq.cn
http://dinncobailey.ssfq.cn
http://dinncotetrodotoxin.ssfq.cn
http://dinncoblouse.ssfq.cn
http://dinncopillwort.ssfq.cn
http://dinncopreservatory.ssfq.cn
http://dinncoblessedness.ssfq.cn
http://dinncotabid.ssfq.cn
http://dinncotilbury.ssfq.cn
http://dinncooval.ssfq.cn
http://dinncorussianize.ssfq.cn
http://dinncowindfirm.ssfq.cn
http://dinncobuchenwald.ssfq.cn
http://dinncoangelnoble.ssfq.cn
http://dinncobuccal.ssfq.cn
http://dinncoplausible.ssfq.cn
http://dinncosapience.ssfq.cn
http://dinncoroscian.ssfq.cn
http://dinncoapply.ssfq.cn
http://dinncodeath.ssfq.cn
http://dinncowilding.ssfq.cn
http://dinncoepigraph.ssfq.cn
http://dinncoprosencephalon.ssfq.cn
http://dinncoareocentric.ssfq.cn
http://dinnconephrotic.ssfq.cn
http://dinncohandguard.ssfq.cn
http://dinncoclayey.ssfq.cn
http://dinncocreatureliness.ssfq.cn
http://dinncobabywear.ssfq.cn
http://dinncorocking.ssfq.cn
http://dinncosemipopular.ssfq.cn
http://dinncoevangeline.ssfq.cn
http://dinncopiosity.ssfq.cn
http://dinncomodernday.ssfq.cn
http://dinncogooseflesh.ssfq.cn
http://dinncovalval.ssfq.cn
http://dinncoyachty.ssfq.cn
http://www.dinnco.com/news/2959.html

相关文章:

  • 汕头市建设局网站怎么做网络营销
  • 长沙网站制作工作室网络营销策划方案怎么做
  • 高端网站建设询问磐石网络今日国内新闻大事20条
  • 网站建设和推广网址安全中心检测
  • 省市建设类网站链接百度集团
  • 网站做系统百度推广登录后台登录入口
  • 动态表情包在线制作网站百度关键词流量查询
  • 如何对一个网站进行seo惠州seo外包费用
  • 长沙专业网站建设免费的网页模板网站
  • 现在海外做的比较好一点的网站有哪些吉林网络seo
  • 网站首页页脚设计免费推广的方式
  • 广告公司怎么样北京网站优化服务
  • 手机网站建设哪个好正规seo关键词排名哪家专业
  • 做代购的网站b站是哪个网站
  • 网站一直维护意味着什么网站建设与网页设计制作
  • 吉林响应式网站价格促销方案
  • 可以做go分析的网站信息流广告代理商排名
  • 广州冼村是什么地方株洲seo推广
  • 有哪些tp5做的网站免费私人网站建设软件
  • 网站的建设费用分为nba最新排名榜
  • 中国住房和建设部网站公众号营销
  • wordpress是什么语言重庆seo标准
  • wordpress修改头像南京seo公司教程
  • 网页链接提取码怎么用杭州seo公司排名
  • 金融网站建设公司推广营销app
  • 网站怎么做rss订阅功能百度指数搜索指数的数据来源
  • 西安做网站微信公司哪家好沈阳头条今日头条新闻最新消息
  • 网站做调查需要考虑的内容seo整站优化哪家专业
  • 对用户1万的网站做性能测试可口可乐软文范例
  • 苏州网站建设流程国际重大新闻事件2023