What is the difference between "shutdown /r" and "shutdown /g"?

25

6

I was reading some of the options for the shutdown command in windows, when I stumbled across the following option descriptions:

/r         Full shutdown and restart the computer.
/g         Full shutdown and restart the computer. After the system is
           rebooted, restart any registered applications.

I thought that when Windows restarts, every application would be closed on the shutdown procedure, and then started again on system boot.

Some possible considerations that come to mind for me are:

  • Carryover from previous versions of Windows that performed some restart trickery
  • Temporarily override the default behavior of system configuration

Is it any of these? None of these?

gate_engineer

Posted 2016-10-06T12:51:24.623

Reputation: 411

My guess would be to reload applications after startup that were running at the time of shutdown /g – adampski – 2016-10-06T12:54:15.197

Answers

37

What is shutdown /g?

The /g option will restart applications that are registered for restart with the RegisterApplicationRestart API.

The Windows Restart Manager (introduced in Windows Vista) supports gracefully shutting down and restarting applications that registered for restart with the RegisterApplicationRestart API.

This functionality is used by Windows Update – thanks to the Restart Manager, when I come yawning to my desktop PC in the morning, even following a system restart, I have my Outlook, browser windows, OneNote, Visual Studio, and Messenger all lined up as they were when I went to bed.

Suppose you want to initiate one of these “automagically restart everything after restart” restarts. As of a few weeks ago, I had it in my head that you have to write a small app that uses the Restart Manager APIs (e.g. RmStartSession and RmShutdown) to do this.

And then it hit me that the shutdown command must have support for doing this. And indeed, it has:

shutdown /g

Source Restart Windows and Restart All Registered Applications: shutdown -g

DavidPostill

Posted 2016-10-06T12:51:24.623

Reputation: 118 938

12TIL Windows Restart Manager exists, thanks ;) :D – Olle Kelderman – 2016-10-06T13:41:44.457

@OlleKelderman Which is a pretty good indication of how useful this option is, generally speaking. – HopelessN00b – 2016-10-06T15:09:37.027

7Funny, when my computer restarts for an update, it most definitely does not have everything back where I left it. In fact, it generally has nothing back where I left it. – KRyan – 2016-10-06T19:15:51.013

2@KRyan It requires Windows Update to register the application with the Restart Manager. I guess that functionality is no longer used. Remember this was introduced in Vista. Windows Update has changed a lot since then. – DavidPostill – 2016-10-06T19:25:55.460

3@DavidPostill rather, it requires windows update to perform the restart in this manner, and the applications need to have registered themselves. – Random832 – 2016-10-06T22:35:13.587

1@Random832 Makes sense. – DavidPostill – 2016-10-06T22:48:48.307