NSIS 以静默模式重新启动。如何沟通?
NSIS Reboot in silent mode. How to communicate?
我们有使用 nsis 安装程序构建的软件。有一次,关于某些情况,我们是否需要重新启动。
这不是问题。我们这样做:
;Reboot instructions. In silent mode just set a RebootFlag and otherwize show the confirmation box.
IfRebootFlag doReboot doNotReboot
doReboot:
IfSilent doSilent doNotSilent
doSilent:
;if silent, do not reboot
Goto doNotReboot
doNotSilent:
MessageBox MB_YESNO "A reboot is required to finish the installation. Do you wish to reboot now?" IDNO doNotReboot
Reboot
doNotReboot:
当我们的管理员通过软件分发安装软件时(而不是由用户直接安装,也不是静默安装),他们需要知道是否需要重新启动。
让他们知道的好方法是什么?为什么?
我们目前有两个选择。
- 写入注册表项。在 Windows 中是否有标准方法或为此目的已经存在的密钥?`
- Return 定义的 return 代码。还有这里,有标准吗?
在此先感谢您的帮助。
MsiExec.exe uses ERROR_SUCCESS_REBOOT_REQUIRED
. You can set the exit code in NSIS with SetErrorLevel
:
!ifndef ERROR_SUCCESS_REBOOT_REQUIRED
!define ERROR_SUCCESS_REBOOT_REQUIRED 3010
!endif
Section
IfRebootFlag ...
...
SetErrorLevel ${ERROR_SUCCESS_REBOOT_REQUIRED}
SectionEnd
我们有使用 nsis 安装程序构建的软件。有一次,关于某些情况,我们是否需要重新启动。
这不是问题。我们这样做:
;Reboot instructions. In silent mode just set a RebootFlag and otherwize show the confirmation box.
IfRebootFlag doReboot doNotReboot
doReboot:
IfSilent doSilent doNotSilent
doSilent:
;if silent, do not reboot
Goto doNotReboot
doNotSilent:
MessageBox MB_YESNO "A reboot is required to finish the installation. Do you wish to reboot now?" IDNO doNotReboot
Reboot
doNotReboot:
当我们的管理员通过软件分发安装软件时(而不是由用户直接安装,也不是静默安装),他们需要知道是否需要重新启动。
让他们知道的好方法是什么?为什么?
我们目前有两个选择。
- 写入注册表项。在 Windows 中是否有标准方法或为此目的已经存在的密钥?`
- Return 定义的 return 代码。还有这里,有标准吗?
在此先感谢您的帮助。
MsiExec.exe uses ERROR_SUCCESS_REBOOT_REQUIRED
. You can set the exit code in NSIS with SetErrorLevel
:
!ifndef ERROR_SUCCESS_REBOOT_REQUIRED
!define ERROR_SUCCESS_REBOOT_REQUIRED 3010
!endif
Section
IfRebootFlag ...
...
SetErrorLevel ${ERROR_SUCCESS_REBOOT_REQUIRED}
SectionEnd