Reputation: 22275
I know that one can reboot a workstation using InitiateShutdown API. I'm curious how to do I reboot and go to "Advanced Boot" option window that is available on Windows 8/10? (I'm asking about WinAPI or a registry setting.)
PS. The same can be achieved by calling:
shutdown \r \o
Upvotes: 4
Views: 389
Reputation: 17293
For Windows 8 and up you can use the undocumented dwShutdownFlags
value 0x400
that will initiate reboot and then show advanced boot menu options. That flag can be combined with SHUTDOWN_RESTART
, SHUTDOWN_RESTARTAPPS
, SHUTDOWN_FORCE_OTHERS
, SHUTDOWN_FORCE_SELF
.
As such:
DWORD dwResult = InitiateShutdown(NULL, NULL,
30, //Use 30-second timeout
SHUTDOWN_RESTART | 0x400, //Reboot with advanced menu options
SHTDN_REASON_FLAG_PLANNED |
SHTDN_REASON_MAJOR_APPLICATION |
SHTDN_REASON_MINOR_OTHER);
Keep in mind though that this flag is undocumented, so use it at your own risk!
Upvotes: 2