如何使用镜像中的复制过程显示安装页面[NSIS脚本]
如何使用镜像中的复制过程显示安装页面[NSIS脚本],nsis,Nsis,脚本中有两个InstFiles页面,不要这样做。您还在InstFiles页面的开头调用函数,但不应在页面函数中执行文件操作 您的文件操作本身没有意义,您不应该基于当前目录进行复制 屏幕截图中的“复制”过程实际上是从安装程序中提取文件,您可以在NSIS中免费获得这些文件: RequestExecutionLevel Admin InstallDir "$ProgramFiles\MyApp" !include MUI2.nsh !include LogicLib.nsh !insertmacro
脚本中有两个InstFiles页面,不要这样做。您还在InstFiles页面的开头调用函数,但不应在页面函数中执行文件操作 您的文件操作本身没有意义,您不应该基于当前目录进行复制 屏幕截图中的“复制”过程实际上是从安装程序中提取文件,您可以在NSIS中免费获得这些文件:
RequestExecutionLevel Admin
InstallDir "$ProgramFiles\MyApp"
!include MUI2.nsh
!include LogicLib.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights to install application
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
FunctionEnd
Section
SetOutPath "$InstDir"
File /r "c:\myfiles" ; This will display the extract progress
SectionEnd
如果确实要复制文件而不是提取文件,则只需删除/SILENT
开关即可显示正常的Windows复制对话框
如果必须复制输出类似于提取的文件,则必须使用
FindFirst
+FindNext
手动遍历源目录,并对每个文件使用DetailPrint
+CopyFiles/SILENT
,上面的代码空安装页面显示为什么要检查图像?这只会让帮助你变得更难。。。
RequestExecutionLevel Admin
InstallDir "$ProgramFiles\MyApp"
!include MUI2.nsh
!include LogicLib.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights to install application
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
FunctionEnd
Section
SetOutPath "$InstDir"
File /r "c:\myfiles" ; This will display the extract progress
SectionEnd