Vista!
Shutting down or rebooting Windows allowing existing applications to reopen
Windows Vista introduced the /g
switch in shutdown.exe
and was unchanged in Windows 7:
/g Shutdown and restart the computer. After the system is rebooted, restart any registered applications.
I never noticed it until Windows 10 which began actively use it when applying system updates: then suddenly many of the previously running applications would reopen during startup.
Note that a nice overview of the various shutdown.exe help texts are at [Wayback] MS-DOS and Windows command line shutdown command. I put the Windows 7, 8.1 and 10 help in the below gist revisions.
The major differences:
- Windows 8.x: “Shutdown” became “Full shutdown” in the
/s
and/g
switches, added/hybrid
and/o
switches:
/r Full shutdown and restart the computer. /g Full shutdown and restart the computer. After the system is rebooted, restart any registered applications. ... /hybrid Performs a shutdown of the computer and prepares it for fast startup. Must be used with /s option. ... /o Go to the advanced boot options menu and restart the computer. Must be used with /r option.
- Windows 10: amended help for
/g
switch with “Automatic Restart Sign-On
” information and/a
switch with/fw
information, and added/sg
and/fw
switches:
/sg Shutdown the computer. On the next boot, if Automatic Restart Sign-On is enabled, automatically sign in and lock last interactive user. After sign in, restart any registered applications. ... /g Full shutdown and restart the computer. After the system is rebooted, if Automatic Restart Sign-On is enabled, automatically sign in and lock last interactive user. After sign in, restart any registered applications. /a Abort a system shutdown. This can only be used during the time-out period. Combine with /fw to clear any pending boots to firmware. ... /fw Combine with a shutdown option to cause the next boot to go to the firmware user interface.
It appears that Windows Vista already understood the /s
and g
combination to perform a full shutdown, but remember the applications that started.
Preparing your applications for reopen after Windows shutdown or restart
There is the [Wayback] RegisterApplicationRestart
function (winbase.h
) – Win32 apps | Microsoft Docs that allows you to register your application to restart when Windows restarts. You can listen to events to save your application state right before Windows restarts.
Some links:
- [Wayback] How to Develop Restart Manager Aware Application: Test Case 30 – CodeProject
- [Wayback] Automatically restart program when crashing? – embarcadero.delphi.rtl
- [Wayback] c# – Restart a crashed program with RegisterApplicationRestart without user prompt – Stack Overflow
- [Wayback] windows – What is the difference between “shutdown /r” and “shutdown /g”? – Super User
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
- [Wayback] How come Word is back after Setup.exe restarts my PC? at Fabian’s Mix
Vista (and thus Server 2008) contains a new Restart Manager, which enables this feature and is used automatically by Windows Installer 4.
To enable your application to restore its sessions, you simply listen for
WM_QUERYENDSESSION
with anlParam
ofENDSESSION_CLOSEAPP
(save your state there) and register your application for restart usingRegisterApplicationRestart
(which is part of the automatic recovery functions, see the MSDN for the P/invoke signatures). If you have a console application, you can also use aCTRL_C_EVENT
handler (or theConsole.CancelKeyPress
event) to save your state, but in this case, you have to callRegisterApplicationRestart
before you get that notification. See the MDSN for more comprehensive guidelines.And that’s it, your application is ready for a clean Windows Update experience.
- [Wayback] The Moth – Vista: Restart Manager
…
protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == WM_QUERYENDSESSION) //0x0011 { if ((m.LParam.ToInt32() & ENDSESSION_CLOSEAPP) == ENDSESSION_CLOSEAPP) //0x1 { // some installation will shut us down next, so do some cleanup (prepare for it) File.WriteAllText(Environment.CurrentDirectory + @"\rm.txt", "for demo purposes"); //MessageBox.Show("intercepted", “RM request”); } } }
…
Jen Gentleman on shutdown.exe
switches
Some posts by Jen Gentleman and replies to them via [Archive.is] @JenMsft shutdown – Twitter Search:
- [Archive.is] Jen Gentleman
on Twitter: “More shutdown options (because Twitter only lets me list four at a time): …
shutdown -t 0 -s
…” - [Archive.is] Jen Gentleman
on Twitter: “If you want to go the command line route (which can be done via the Run dialog), the two commands are:
shutdown -t 0 -g
–> restart and save apps I had open (that support it) and reopen them aftershutdown -t 0 -sg
–> shutdown and save apps for when I boot up and sign in again… “ - [Archive.is] Robin Persaud on Twitter: “Yes! But I flip the order:
shutdown -f -r -t 1
… “ - [Archive.is] Daniel Pache
on Twitter: “There’s a port for Windows:
shutdown -s -f -t 1
… “ (in response to Linuxsudo shutdown now
) - [Archive.is] SoS on Twitter: “Top commands to know as a Windows user: 1.
shutdown /f /r /t 0
… “ - [Archive.is]
on Twitter: “Don’t think you need a /f as long as you include /t 1… “
- [Archive.is] Artem Pronichkin on Twitter: “No Start menu for you Jeff, get back to Server Core. `
shutdown.exe /r /o
` will give you the same screen, though.… “ - [Archive.is] anamyd on Twitter: “I still had to after upgrading my 333MHz Pentium II to XP and 512MB of RAM etc, *until* I managed to get it to auto shutdown after changing a BIOS setting
… “
All of the above because of [Wayback] Thread by @jpluimers on Thread Reader App – Thread Reader App:
I remembered that, when I was in hospital, @JenMsft a while back mentioning that you can manually shutdown and save apps for reopen after booting.
She did, multiple times: [Archive.is] twitter.com/search?q=from%…
It’s the
/g
switch of shutdown.exeI wondered how long ago that was introduced…
I still have Windows XP and Windows 7 VM’s for experiments like this. Windows XP shutdown.exe didn’t have it, but Windows 7 shutdown.exe had.So when was it introduced?
… drumroll …
superuser.com/questions/1132091…
Windows Vista!
I’ve been living under a stone for a long time (:
The superuser post also mentions docs.microsoft.com/en-gb/windows/…RegisterApplicationRestart [Wayback]
I sense a blog post coming up about it.
Thanks @JenMsft for teaching an old fart something new!
/t 1
versus /t 0
and Windows XP shutdown.exe help
When writing this, I wondered why some people consistently use /t 1 (timeout ) and others /t 0, and even asked for explanation [Archive.is] Jeroen Wiert Pluimers on Twitter: “why /t 1 instead of /t 0 ?… “ (but no answer).
The reason is simple:
/t xxx Set the time-out period before shutdown to xxx seconds. The valid range is 0-315360000 (10 years), with a default of 30. If the timeout period is greater than 0, the /f parameter is implied. ... /f Force running applications to close without forewarning users. The /f parameter is implied when a value greater than 0 is specified for the /t parameter.
/t 0
does not imply/f
/t 1
implies/f
, but the time-out is so short that nobody can cancel, so it is sort of immediate
Looking at the Windows XP help for shutdown.exe
, I realised two things:
- I never looked at the switches after Windows XP, so I totally missed the
/f
,/g
and/sg
ones - People still use the minus sign (
-
) to prefixshutdown.exe
switches instead of the slash (/
) as that was the preferred prefix until Windows XP.
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [u][p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536)
–jeroen
Gist with Windows 7, 8.1 and 10 help for shutdown.exe
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f] | |
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]] | |
No args Display help. This is the same as typing /?. | |
/? Display help. This is the same as not typing any options. | |
/i Display the graphical user interface (GUI). | |
This must be the first option. | |
/l Log off. This cannot be used with /m or /d options. | |
/s Shutdown the computer. | |
/sg Shutdown the computer. On the next boot, if Automatic Restart Sign-On | |
is enabled, automatically sign in and lock last interactive user. | |
After sign in, restart any registered applications. | |
/r Full shutdown and restart the computer. | |
/g Full shutdown and restart the computer. After the system is rebooted, | |
if Automatic Restart Sign-On is enabled, automatically sign in and | |
lock last interactive user. | |
After sign in, restart any registered applications. | |
/a Abort a system shutdown. | |
This can only be used during the time-out period. | |
Combine with /fw to clear any pending boots to firmware. | |
/p Turn off the local computer with no time-out or warning. | |
Can be used with /d and /f options. | |
/h Hibernate the local computer. | |
Can be used with the /f option. | |
/hybrid Performs a shutdown of the computer and prepares it for fast startup. | |
Must be used with /s option. | |
/fw Combine with a shutdown option to cause the next boot to go to the | |
firmware user interface. | |
/e Document the reason for an unexpected shutdown of a computer. | |
/o Go to the advanced boot options menu and restart the computer. | |
Must be used with /r option. | |
/m \\computer Specify the target computer. | |
/t xxx Set the time-out period before shutdown to xxx seconds. | |
The valid range is 0-315360000 (10 years), with a default of 30. | |
If the timeout period is greater than 0, the /f parameter is | |
implied. | |
/c "comment" Comment on the reason for the restart or shutdown. | |
Maximum of 512 characters allowed. | |
/f Force running applications to close without forewarning users. | |
The /f parameter is implied when a value greater than 0 is | |
specified for the /t parameter. | |
/d [p|u:]xx:yy Provide the reason for the restart or shutdown. | |
p indicates that the restart or shutdown is planned. | |
u indicates that the reason is user defined. | |
If neither p nor u is specified the restart or shutdown is | |
unplanned. | |
xx is the major reason number (positive integer less than 256). | |
yy is the minor reason number (positive integer less than 65536). | |
Reasons on this computer: | |
(E = Expected U = Unexpected P = planned, C = customer defined) | |
Type Major Minor Title | |
U 0 0 Other (Unplanned) | |
E 0 0 Other (Unplanned) | |
E P 0 0 Other (Planned) | |
U 0 5 Other Failure: System Unresponsive | |
E 1 1 Hardware: Maintenance (Unplanned) | |
E P 1 1 Hardware: Maintenance (Planned) | |
E 1 2 Hardware: Installation (Unplanned) | |
E P 1 2 Hardware: Installation (Planned) | |
E 2 2 Operating System: Recovery (Unplanned) | |
E P 2 2 Operating System: Recovery (Planned) | |
P 2 3 Operating System: Upgrade (Planned) | |
E 2 4 Operating System: Reconfiguration (Unplanned) | |
E P 2 4 Operating System: Reconfiguration (Planned) | |
P 2 16 Operating System: Service pack (Planned) | |
2 17 Operating System: Hot fix (Unplanned) | |
P 2 17 Operating System: Hot fix (Planned) | |
2 18 Operating System: Security fix (Unplanned) | |
P 2 18 Operating System: Security fix (Planned) | |
E 4 1 Application: Maintenance (Unplanned) | |
E P 4 1 Application: Maintenance (Planned) | |
E P 4 2 Application: Installation (Planned) | |
E 4 5 Application: Unresponsive | |
E 4 6 Application: Unstable | |
U 5 15 System Failure: Stop error | |
U 5 19 Security issue (Unplanned) | |
E 5 19 Security issue (Unplanned) | |
E P 5 19 Security issue (Planned) | |
E 5 20 Loss of network connectivity (Unplanned) | |
U 6 11 Power Failure: Cord Unplugged | |
U 6 12 Power Failure: Environment | |
P 7 0 Legacy API shutdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f] | |
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]] | |
No args Display help. This is the same as typing /?. | |
/? Display help. This is the same as not typing any options. | |
/i Display the graphical user interface (GUI). | |
This must be the first option. | |
/l Log off. This cannot be used with /m or /d options. | |
/s Shutdown the computer. | |
/sg Shutdown the computer. On the next boot, if Automatic Restart Sign-On | |
is enabled, automatically sign in and lock last interactive user. | |
After sign in, restart any registered applications. | |
/r Full shutdown and restart the computer. | |
/g Full shutdown and restart the computer. After the system is rebooted, | |
if Automatic Restart Sign-On is enabled, automatically sign in and | |
lock last interactive user. | |
After sign in, restart any registered applications. | |
/a Abort a system shutdown. | |
This can only be used during the time-out period. | |
Combine with /fw to clear any pending boots to firmware. | |
/p Turn off the local computer with no time-out or warning. | |
Can be used with /d and /f options. | |
/h Hibernate the local computer. | |
Can be used with the /f option. | |
/hybrid Performs a shutdown of the computer and prepares it for fast startup. | |
Must be used with /s option. | |
/fw Combine with a shutdown option to cause the next boot to go to the | |
firmware user interface. | |
/e Document the reason for an unexpected shutdown of a computer. | |
/o Go to the advanced boot options menu and restart the computer. | |
Must be used with /r option. | |
/m \\computer Specify the target computer. | |
/t xxx Set the time-out period before shutdown to xxx seconds. | |
The valid range is 0-315360000 (10 years), with a default of 30. | |
If the timeout period is greater than 0, the /f parameter is | |
implied. | |
/c "comment" Comment on the reason for the restart or shutdown. | |
Maximum of 512 characters allowed. | |
/f Force running applications to close without forewarning users. | |
The /f parameter is implied when a value greater than 0 is | |
specified for the /t parameter. | |
/d [p|u:]xx:yy Provide the reason for the restart or shutdown. | |
p indicates that the restart or shutdown is planned. | |
u indicates that the reason is user defined. | |
If neither p nor u is specified the restart or shutdown is | |
unplanned. | |
xx is the major reason number (positive integer less than 256). | |
yy is the minor reason number (positive integer less than 65536). | |
Reasons on this computer: | |
(E = Expected U = Unexpected P = planned, C = customer defined) | |
Type Major Minor Title | |
U 0 0 Other (Unplanned) | |
E 0 0 Other (Unplanned) | |
E P 0 0 Other (Planned) | |
U 0 5 Other Failure: System Unresponsive | |
E 1 1 Hardware: Maintenance (Unplanned) | |
E P 1 1 Hardware: Maintenance (Planned) | |
E 1 2 Hardware: Installation (Unplanned) | |
E P 1 2 Hardware: Installation (Planned) | |
E 2 2 Operating System: Recovery (Unplanned) | |
E P 2 2 Operating System: Recovery (Planned) | |
P 2 3 Operating System: Upgrade (Planned) | |
E 2 4 Operating System: Reconfiguration (Unplanned) | |
E P 2 4 Operating System: Reconfiguration (Planned) | |
P 2 16 Operating System: Service pack (Planned) | |
2 17 Operating System: Hot fix (Unplanned) | |
P 2 17 Operating System: Hot fix (Planned) | |
2 18 Operating System: Security fix (Unplanned) | |
P 2 18 Operating System: Security fix (Planned) | |
E 4 1 Application: Maintenance (Unplanned) | |
E P 4 1 Application: Maintenance (Planned) | |
E P 4 2 Application: Installation (Planned) | |
E 4 5 Application: Unresponsive | |
E 4 6 Application: Unstable | |
U 5 15 System Failure: Stop error | |
U 5 19 Security issue (Unplanned) | |
E 5 19 Security issue (Unplanned) | |
E P 5 19 Security issue (Planned) | |
E 5 20 Loss of network connectivity (Unplanned) | |
U 6 11 Power Failure: Cord Unplugged | |
U 6 12 Power Failure: Environment | |
P 7 0 Legacy API shutdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] | |
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]] | |
No args Display help. This is the same as typing /?. | |
/? Display help. This is the same as not typing any options. | |
/i Display the graphical user interface (GUI). | |
This must be the first option. | |
/l Log off. This cannot be used with /m or /d options. | |
/s Shutdown the computer. | |
/r Shutdown and restart the computer. | |
/g Shutdown and restart the computer. After the system is | |
rebooted, restart any registered applications. | |
/a Abort a system shutdown. | |
This can only be used during the time-out period. | |
/p Turn off the local computer with no time-out or warning. | |
Can be used with /d and /f options. | |
/h Hibernate the local computer. | |
Can be used with the /f option. | |
/e Document the reason for an unexpected shutdown of a computer. | |
/m \\computer Specify the target computer. | |
/t xxx Set the time-out period before shutdown to xxx seconds. | |
The valid range is 0-315360000 (10 years), with a default of 30. | |
If the timeout period is greater than 0, the /f parameter is | |
implied. | |
/c "comment" Comment on the reason for the restart or shutdown. | |
Maximum of 512 characters allowed. | |
/f Force running applications to close without forewarning users. | |
The /f parameter is implied when a value greater than 0 is | |
specified for the /t parameter. | |
/d [p|u:]xx:yy Provide the reason for the restart or shutdown. | |
p indicates that the restart or shutdown is planned. | |
u indicates that the reason is user defined. | |
If neither p nor u is specified the restart or shutdown is | |
unplanned. | |
xx is the major reason number (positive integer less than 256). | |
yy is the minor reason number (positive integer less than 65536). | |
Reasons on this computer: | |
(E = Expected U = Unexpected P = planned, C = customer defined) | |
Type Major Minor Title | |
U 0 0 Other (Unplanned) | |
E 0 0 Other (Unplanned) | |
E P 0 0 Other (Planned) | |
U 0 5 Other Failure: System Unresponsive | |
E 1 1 Hardware: Maintenance (Unplanned) | |
E P 1 1 Hardware: Maintenance (Planned) | |
E 1 2 Hardware: Installation (Unplanned) | |
E P 1 2 Hardware: Installation (Planned) | |
E 2 2 Operating System: Recovery (Planned) | |
E P 2 2 Operating System: Recovery (Planned) | |
P 2 3 Operating System: Upgrade (Planned) | |
E 2 4 Operating System: Reconfiguration (Unplanned) | |
E P 2 4 Operating System: Reconfiguration (Planned) | |
P 2 16 Operating System: Service pack (Planned) | |
2 17 Operating System: Hot fix (Unplanned) | |
P 2 17 Operating System: Hot fix (Planned) | |
2 18 Operating System: Security fix (Unplanned) | |
P 2 18 Operating System: Security fix (Planned) | |
E 4 1 Application: Maintenance (Unplanned) | |
E P 4 1 Application: Maintenance (Planned) | |
E P 4 2 Application: Installation (Planned) | |
E 4 5 Application: Unresponsive | |
E 4 6 Application: Unstable | |
U 5 15 System Failure: Stop error | |
U 5 19 Security issue | |
E 5 19 Security issue | |
E P 5 19 Security issue | |
E 5 20 Loss of network connectivity (Unplanned) | |
U 6 11 Power Failure: Cord Unplugged | |
U 6 12 Power Failure: Environment | |
P 7 0 Legacy API shutdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/f] | |
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]] | |
No args Display help. This is the same as typing /?. | |
/? Display help. This is the same as not typing any options. | |
/i Display the graphical user interface (GUI). | |
This must be the first option. | |
/l Log off. This cannot be used with /m or /d options. | |
/s Shutdown the computer. | |
/r Full shutdown and restart the computer. | |
/g Full shutdown and restart the computer. After the system is | |
rebooted, restart any registered applications. | |
/a Abort a system shutdown. | |
This can only be used during the time-out period. | |
/p Turn off the local computer with no time-out or warning. | |
Can be used with /d and /f options. | |
/h Hibernate the local computer. | |
Can be used with the /f option. | |
/hybrid Performs a shutdown of the computer and prepares it for fast startup. | |
Must be used with /s option. | |
/e Document the reason for an unexpected shutdown of a computer. | |
/o Go to the advanced boot options menu and restart the computer. | |
Must be used with /r option. | |
/m \\computer Specify the target computer. | |
/t xxx Set the time-out period before shutdown to xxx seconds. | |
The valid range is 0-315360000 (10 years), with a default of 30. | |
If the timeout period is greater than 0, the /f parameter is | |
implied. | |
/c "comment" Comment on the reason for the restart or shutdown. | |
Maximum of 512 characters allowed. | |
/f Force running applications to close without forewarning users. | |
The /f parameter is implied when a value greater than 0 is | |
specified for the /t parameter. | |
/d [p|u:]xx:yy Provide the reason for the restart or shutdown. | |
p indicates that the restart or shutdown is planned. | |
u indicates that the reason is user defined. | |
If neither p nor u is specified the restart or shutdown is | |
unplanned. | |
xx is the major reason number (positive integer less than 256). | |
yy is the minor reason number (positive integer less than 65536). | |
Reasons on this computer: | |
(E = Expected U = Unexpected P = planned, C = customer defined) | |
Type Major Minor Title | |
U 0 0 Other (Unplanned) | |
E 0 0 Other (Unplanned) | |
E P 0 0 Other (Planned) | |
U 0 5 Other Failure: System Unresponsive | |
E 1 1 Hardware: Maintenance (Unplanned) | |
E P 1 1 Hardware: Maintenance (Planned) | |
E 1 2 Hardware: Installation (Unplanned) | |
E P 1 2 Hardware: Installation (Planned) | |
E 2 2 Operating System: Recovery (Unplanned) | |
E P 2 2 Operating System: Recovery (Planned) | |
P 2 3 Operating System: Upgrade (Planned) | |
E 2 4 Operating System: Reconfiguration (Unplanned) | |
E P 2 4 Operating System: Reconfiguration (Planned) | |
P 2 16 Operating System: Service pack (Planned) | |
2 17 Operating System: Hot fix (Unplanned) | |
P 2 17 Operating System: Hot fix (Planned) | |
2 18 Operating System: Security fix (Unplanned) | |
P 2 18 Operating System: Security fix (Planned) | |
E 4 1 Application: Maintenance (Unplanned) | |
E P 4 1 Application: Maintenance (Planned) | |
E P 4 2 Application: Installation (Planned) | |
E 4 5 Application: Unresponsive | |
E 4 6 Application: Unstable | |
U 5 15 System Failure: Stop error | |
U 5 19 Security issue (Unplanned) | |
E 5 19 Security issue (Unplanned) | |
E P 5 19 Security issue (Planned) | |
E 5 20 Loss of network connectivity (Unplanned) | |
U 6 11 Power Failure: Cord Unplugged | |
U 6 12 Power Failure: Environment | |
P 7 0 Legacy API shutdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy] | |
No args Display this message (same as -?) | |
-i Display GUI interface, must be the first option | |
-l Log off (cannot be used with -m option) | |
-s Shutdown the computer | |
-r Shutdown and restart the computer | |
-a Abort a system shutdown | |
-m \\computername Remote computer to shutdown/restart/abort | |
-t xx Set timeout for shutdown to xx seconds | |
-c "comment" Shutdown comment (maximum of 127 characters) | |
-f Forces running applications to close without warning | |
-d [u][p]:xx:yy The reason code for the shutdown | |
u is the user code | |
p is a planned shutdown code | |
xx is the major reason code (positive integer less than 256) | |
yy is the minor reason code (positive integer less than 65536) |