REBOOT
This command logs off the current user, shuts down the system, or shuts down and restarts the system. It sends the WM_QUERYENDSESSION message to all applications to determine if they can be terminated.
1, [ErrorMode], [Flags]
Parameters
ErrorMode
Optional. Specified as a decimal representation of a hexadecimal bitmask. Values must be specified in decimal format. The following table shows the possible values.Value Name Description 0 (0xnnnn0000) DAERH_ABORT Default. The abort-on-error mode stops the command file from processing further. 32768 (0xnnnn8000) DAERH_IGNORE The ignore-on-error mode continues by processing the next command when an error occurs. 32769-33023 (0x000080xx where xx!=00 is the number of retries) DAERH_RETRY_WITHIGNORE The retry-on-error with ignore mode retries the offending command up to 255 times. If the number of retries exceeds the retry count, this mode continues processing the next command. 1-255(0x00xx where xx!=0 is the number of retries from 1-255) DAERH_RETRY_WITHABORT The retry-on-error with abort mode retries the offending command up to 255 times. If the number of retries exceeds the retry count, the command file processing halts. 65536 – 4294901760(0xFFFFnnnn where FFFF is the delay mask in seconds) DAERH_DELAYMASK The delay error mode value is added to either the DAERH_RETRY_WITHIGNORE or the DAERH_RETRY_WITHABORT value to cause a delay between retries. This value is in seconds and has a range between 1 and 65535. Note Parsing errors, especially the passing of not valid command parameters, generates an error in DAERH_ABORT error mode. With logging enabled, an appropriate error message is output to the log file.
Flags
Optional. Specifies the type of shutdown or reboot. The default is DAREBOOTOPT_REBOOT | DAREBOOTOPT_FORCEIFHUNG. The following table shows the possible values.Value Name Description 1 DAREBOOTOPT_SHUTDOWN Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped. If the system supports the power-off feature, the power is also turned off. 2 DAREBOOTOPT_REBOOT Shuts down the system and then restarts the system. 4 DAREBOOTOPT_FORCE Optional. Forces processes to terminate. When this flag is set, the system does not send the WM_QUERYENDSESSION and WM_ENDSESSION messages. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency. 8 DAREBOOTOPT_POWEROFF Shuts down the system and turns off the power. The system must support the power-off feature. 16 DAREBOOTOPT_FORCEIFHUNG Optional. Forces processes to terminate if they do not respond to the WM_QUERYENDSESSION or WM_ENDSESSION message. This flag is ignored if DAREBOOTOPT_FORCE is used. These values use bitwise OR to connect them.
Remarks
During a shutdown or log off operation, applications that are shut down are allowed a specific amount of time to respond to the shutdown request. If the time expires, the system displays a dialog box that allows the user to forcibly shut down the application, to retry the shutdown, or to cancel the shutdown request. If the DAREBOOTOPT_FORCE value is specified, the system always forces applications to close and does not display the dialog box.
For more information, see the Microsoft Windows SDK documentation at this Microsoft Web site.
Example
The following example shows typical use.
//
// Reboot: Shutdown and restart the device.
//
REBOOT,,DAREBOOTOPT_REBOOT
See Also
Last updated on Wednesday, October 18, 2006
© 2006 Microsoft Corporation. All rights reserved.