NSIS nsi脚本错误:-!insertmacro:名为“的宏”;第“U开始”节;找不到
在nsi脚本中使用MUI2.nsh 代码:-NSIS nsi脚本错误:-!insertmacro:名为“的宏”;第“U开始”节;找不到,nsis,Nsis,在nsi脚本中使用MUI2.nsh 代码:- !macro SECTION_BEGIN Section "" Call zip2exe.SetOutPath !macroend !macro SECTION_END SectionEnd !macroend 但如果我想定义两个或更多的部分,那么在这种情况下,如何合并部分 Section "Main Component" MainCom #SectionIn RO # Just means if in component mode
!macro SECTION_BEGIN
Section ""
Call zip2exe.SetOutPath
!macroend
!macro SECTION_END
SectionEnd
!macroend
但如果我想定义两个或更多的部分,那么在这种情况下,如何合并部分
Section "Main Component" MainCom
#SectionIn RO # Just means if in component mode this is locked
Call zip2exe.SetOutPath
;Store installation folder in registry
WriteRegStr HKLM "Software\${ZIP2EXE_NAME}" "" $INSTDIR
;Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ZIP2EXE_NAME}" "DisplayName" "${ZIP2EXE_NAME}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ZIP2EXE_NAME}" "NoRepair" 1
;Create optional start menu shortcut for uninstaller and Main component
;Create uninstaller
WriteUninstaller "${ZIP2EXE_NAME}_uninstaller.exe"
#!macroend
#!macro SECTION_END
SectionEnd
#!macroend
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;Delete the appdata directory + files
RMDir /r "${INSTDIR_DATA}\*.*"
RMDir "${INSTDIR_DATA}"
;Delete Start Menu Shortcuts
Delete "$SMPROGRAMS\${ZIP2EXE_NAME}\*.*"
RmDir "$SMPROGRAMS\${ZIP2EXE_NAME}"
SectionEnd
#!macro SECTION_END
如果我们省略了开始部分,那么错误就来了。如果我们在两个部分中都提到“开始”部分,那么也会出现错误。
这个问题的解决方案是什么?如果您确实想使用Zip2Exe,那么您可以从
!macro SECTION_END
SectionEnd
!macroend
像这样的事情
!macro SECTION_END
SectionEnd
!if /FileExists "c:\mycustomzip2exefiles\mycustomsections.nsh"
!include "c:\mycustomzip2exefiles\mycustomsections.nsh"
!endif
!macroend
然后,您可以在c:\mycustomzip2exefiles\mycustomsections.nsh
中放入所需的任何代码:
Section "My other section"
SetOutPath $InstDir
File "anotherfile.txt"
SectionEnd
但是,Zip2Exe主要用于创建简单的自解压可执行文件,不应用于创建完整的安装程序
当您创建一个真正的安装程序时,您不使用Zip2Exe,而是使用MakeNSIS,并且没有SECTION_BEGIN宏这样的东西,您只需在.NSI文件中添加任意数量的节即可
包含一个基本的安装程序/卸载程序。是否使用Zip2Exe?