Skip to main content

Windows中“shutdown / r”和“shutdown / g”之間有什麼區別?

Windows中“shutdown / r”和“shutdown / g”之間有什麼區別?

Geoffrey Carr

當您開始深入了解Windows中的所有可用選項時,您可能會對您能找到的內容感到驚訝。拿走 shutdown /rshutdown /g 例如,命令。它們之間有什麼區別?今天的超級用戶問答帖子有一個好奇的讀者問題的答案。

今天的問答環節由SuperUser提供,這是Stack Exchange的一個細分,Stack Exchange是一個社區驅動的問答網站分組。

問題

超級用戶閱讀器gate_engineer想知道Windows中“shutdown / r”和“shutdown / g”之間的區別是:

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

I thought that when Windows restarts, every application would be closed during the shutdown process, then started again after the system boots. Some possibilities that come to mind are:

  • A holdover from previous versions of Windows that performed some type of restart trickery
  • A temporary override of the system configuration’s default behavior

Is it either of these or something completely different?

Windows中的“shutdown / r”和“shutdown / g”有什麼區別?

答案

超級用戶貢獻者DavidPostill為我們提供了答案:

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 show up to my desktop computer yawning in the morning (even following a system restart), I have my Outlook, browser, OneNote, Visual Studio, and messenger applications all lined up as they were when I went to bed.

Suppose that you want to initiate “automagically restarting” everything after a restart. As of a few weeks ago, I thought it was necessary to write a small application that uses the Restart Manager APIs (i.e. RmStartSession and RmShutdown) to do this. And then it hit me that the shutdown command must already have support for doing this. And indeed, it has:

  • shutdown /g

Source: Restart Windows and Restart All Registered Applications: shutdown -g [Microsoft]


有什麼要補充說明嗎?在評論中發聲。想要從其他精通技術的Stack Exchange用戶那裡閱讀更多答案嗎?在這裡查看完整的討論主題。

Link
Plus
Send
Send
Pin