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

问题描述 投票:3回答:1

我在用:

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

SetOverwrite on

; Put file there
File "ACC\*.APP"

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

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

file installer nsis overwrite
1个回答
5
投票

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

!include LogicLib.nsh
Section
ClearErrors
SetOverwrite try
SetOutPath $INSTDIR
File "ACC\*.APP"
${If} ${Errors}
  Quit
${EndIf}
SectionEnd
© www.soinside.com 2019 - 2024. All rights reserved.