samle-install.nsi.bat
发布日期:2021-10-16 03:16:10 浏览次数:0 分类:技术文章
@echo offset FILES_DIR=.\sampleset SOFT_NAME=示例set EXE_NAME=sampleset ROOT_DIR=sampleset LINK_DIR=binREM NISI文件内容echo ;--------------------------------echo ;Include Modern UIecho   !include "MUI2.nsh"echo ;--------------------------------echo ;Generalecho   ;Name and fileecho   Name "%SOFT_NAME%"echo   OutFile "%EXE_NAME%.exe"echo   Unicode True  echo   ;Default installation folderecho   InstallDir "$PROGRAMFILES\%ROOT_DIR%"echo ;Request application privilegesecho   RequestExecutionLevel userecho   ;--------------------------------echo ;Variablesecho   Var StartMenuFolderecho   ;--------------------------------echo ;Pagesecho   !insertmacro MUI_PAGE_DIRECTORYecho   !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolderecho   !insertmacro MUI_PAGE_INSTFILESecho   ;unstallecho   !insertmacro MUI_UNPAGE_CONFIRMecho   !insertmacro MUI_UNPAGE_INSTFILESecho   ;--------------------------------echo ;Languagesecho   !insertmacro MUI_LANGUAGE "SimpChinese"echo   ;--------------------------------echo ;Installer Sectionsecho ;安装设置echo Section echo   SetOutPath "$INSTDIR"REM /nonfatal :当目录下不存在文件时,仅告警提示echo   file /nonfatal %FILES_DIR%\*.*call   :find_dir %FILES_DIR%echo   ;桌面快捷方式echo   createShortCut "$DESKTOP\%SOFT_NAME%.lnk" "$INSTDIR\%LINK_DIR%\%EXE_NAME%.exe"echo   ;Create uninstallerecho   WriteUninstaller "$INSTDIR\Uninstall.exe"echo   !insertmacro MUI_STARTMENU_WRITE_BEGIN Applicationecho    ;Create shortcutsecho    CreateDirectory "$SMPROGRAMS\$StartMenuFolder"echo    createShortCut "$SMPROGRAMS\$StartMenuFolder\%SOFT_NAME%.lnk" "$INSTDIR\%LINK_DIR%\%EXE_NAME%.exe"echo    CreateShortcut "$SMPROGRAMS\$StartMenuFolder\卸载.lnk" "$INSTDIR\Uninstall.exe"echo   !insertmacro MUI_STARTMENU_WRITE_ENDecho SectionEndecho ;卸载设置echo Section "Uninstall"echo   RMDir /r "$INSTDIR"echo   Delete "$DESKTOP\%SOFT_NAME%.lnk"echo   !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolderecho   Delete "$SMPROGRAMS\$StartMenuFolder\%SOFT_NAME%.lnk"echo   Delete "$SMPROGRAMS\$StartMenuFolder\卸载.lnk"echo   RMDir "$SMPROGRAMS\$StartMenuFolder"echo SectionEndgoto :end:find_file  for %%a in (%1\*.*) do (	echo setOutPath $INSTDIR%2	echo file  %1\*.*	goto :end)goto:eof:find_dirfor /f %%a in ('dir %1 /b /ad') do (	call :find_file %1\%%a %2\%%a 	call :find_dir %1\%%a %2\%%a):end

上一篇:批处理判断指定目录是否存在文件
下一篇:linux 指令备忘录