如果文件未被覆盖,则退出安装程序

sql*_*ild 3 installer nsis file overwrite

我在用:

; Set output path to the installation directory.
SetOutPath $INSTDIR\

SetOverwrite on

; Put file there
File "ACC\*.APP"
Run Code Online (Sandbox Code Playgroud)

覆盖文件,但如果文件无法覆盖,那么我希望安装程序退出,如何执行此操作?

是否需要使用错误标志值?但是怎么样?

And*_*ers 5

如果覆盖模式设置为'try'且文件无法覆盖,或者覆盖模式设置为'on'且文件无法覆盖且用户选择忽略,则File命令会设置错误标志

!include LogicLib.nsh
Section
ClearErrors
SetOverwrite try
SetOutPath $INSTDIR
File "ACC\*.APP"
${If} ${Errors}
  Quit
${EndIf}
SectionEnd
Run Code Online (Sandbox Code Playgroud)

  • @sqlchild:使用"SetOverwrite try" (3认同)