大网数据广告活动
安装更新与部署

ForceReboot Action

· 52CE 我爱测

The ForceReboot action prompts the user for a restart of the system during the installation.

The ForceReboot action prompts the user for a restart of the system during the installation. The ForceReboot action is different from the ScheduleReboot action in that the ScheduleReboot action is used to schedule a prompt to restart at the end of the installation.

If the installation has a user interface, the installer displays a dialog box at each ForceReboot action which prompts the user to restart the system. The user must respond to this prompt before continuing with the installation. If the installation has no user interface, the system automatically restarts at the ForceReboot action.

If the installer determines that a restart is necessary, it automatically prompts the user to restart at the end of the installation, whether or not there are any ForceReboot or ScheduleReboot actions in the sequence. For example, the installer automatically prompts for a restart if it needs to replace any files used during the installation.

Suppress certain restart prompts by setting the REBOOT property.

If the Windows Installer encounters the ForceReboot or ScheduleReboot action during a multiple-package installation, the installer will stop and roll back the installation. Other packages belonging to the multiple-package installation, that do not contain a ForceReboot or ScheduleReboot action, can be installed.

Sequence Restrictions

The following actions commonly occur together as a group in the action sequence. It is recommended that the ForceReboot action be scheduled to come after this group. If the ForceReboot action is scheduled before the RegisterProduct action, the installer again requires the source of the installation package after the restart. Therefore, the preferred sequence for ForceReboot is immediately following this action sequence.

The ForceReboot action must come between InstallInitialize and InstallFinalize in the action sequence of the InstallExecuteSequence table.

ActionData Messages

There are no ActionData messages.

Remarks

The ForceReboot action must always be used with a conditional statement such that the installer triggers a restart only when necessary. For example, a restart may only be required if a particular file is replaced or a particular component is installed. Each product installation is unique and a custom action may be required to determine whether a restart is needed. The condition on the ForceReboot action commonly makes use of the AFTERREBOOT property.

ForceReboot runs system operations generated by any previous actions before prompting for a restart or restarting. For example, the system operations generated by InstallFiles and WriteRegistryValues are run before a restart.

The ForceReboot action writes a registry key that causes the installer to start after restarting. The location of this key is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce.

Related topics

System Reboots

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。