Files

136 lines
12 KiB
Plaintext
Raw Permalink Normal View History

Episode: 2783
Title: HPR2783: The Windows "Shutdown.exe" Command Explained
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2783/hpr2783.mp3
Transcribed: 2025-10-19 16:47:32
---
This is HPR Episode 2783 entitled The Windows Shutdown.exe Command Explained.
It is hosted by Claudio Miranda and is about 15 minutes long and Karima Clean Flag.
The summary is a rundown of The Windows Shutdown.exe Command.
This episode of HPR is brought to you by archive.org.
Support universal access to all knowledge by heading over to archive.org forward slash donate.
Hi Hacker Public Radio. This is Claudio Miranda.
Recording a follow-up episode to that of The Shutdown Command that the previous two episodes
that were recorded by JWP and Clotu, those would be episodes 2697 by JWP regarding the Linux
Shutdown Command Explained and Episode 2725 the Illumar Shutdown Command Explained by Clotu.
Now in this one I'll be covering the Shutdown.exe Command in Windows.
Now you probably didn't know that Windows had a command line Shutdown Command
but it actually has been there since Windows 2000. It was introduced in Windows 2000
as a way to shut down the PC using the command prompt. Given that Windows 2000 was more of a
workstation OS it kind of makes sense that they would include a way to do this similar to how you
have it in the Unix-like operating systems. So as mentioned it's been in all versions of Windows
since 2000 and you'll find it all the way to Windows 10 and even Windows Server 2019.
As a matter of fact, ReactOS, the binary compatible clone of Windows also includes the Shutdown.exe
Command and the Command are the same. And in all these operating systems you'll find the Shutdown.exe
Command in the C colon backslash Windows backslash system 32 directory.
Now I've included some links in the show notes that'll give more explanation into how to use
the Shutdown.exe Command as well as the history of it. But I'll cover a few of those in this episode.
So I'm reading this off of the SS64.com page which actually has a number of numerous commands.
Listed on there not just for Windows but also for other operating systems.
So the syntax for the Shutdown command is Shutdown space the options listed which is usually a forward
slash. Although I have to tell you just from my my habit of shutting down on Linux and the BSDs
I always end up using a hyphen. The hyphen does work in the Shutdown.exe command. So if you're
like me and you're used to using the hyphen on Linux or on the BSDs it'll work here as well.
I don't like using the forward slash. It's just you know creature habit but anyway. So shutdown
fall by space, fall by the options given the shutdown options and then followed by
other options that are listed. Now the nice thing about this Shutdown command and I don't
know if this is possible on the on the Shutdown command for Linux or Illumos or the BSDs but the
Windows Shutdown command will actually allow you to shut down a remote computer so long as you
have administrative privileges to do so on those machines. Okay so let's run down the Shutdown
options. So going forward all of these are forward slash so anytime I'm just going to call it a
slash so assume that when I say slash it's a forward slash. Okay so the first one given is slash
which what this does is it displays a little GUI for the command. So if you want to run the Shutdown
command on your machine for example you would run shut down space slash I and that'll come up
with a prompt that'll give you all the other options as well. Now this has to be the first option
if you're going to use the GUI. Okay the next one is a slash L and what that does is it logs you
off of the computer so or it logs off the remote computer. So slash L you would just shut down space
slash L and that would log you off. Now it can't be used with the slash M which is for for sending
the command to remote computer or the slash the option. Now slash L slash S I'm sorry is the
shutdown option. So if you do shutdown space slash S it will shut down the computer.
Slash SG will shut down the computer and on the next boot will restart any registered
applications in Windows. The slash R will restart the computer so if you do shutdown space slash R
it'll reboot it. Slash G will do the same thing but after restarting it will restart any
registered applications. Now if you've set a time there is a slash T where it allows you to set a
timeout period. So let's say you set out a timeout period for particular machine but you'd say no
I don't want to shut it down. Well you do the shutdown space slash A and that'll abort the system
shutdown with during the timeout period. Slash P will turn off the local computer with no timeout
or warning and that's only with slash D. So it's like a power off. Slash H will hibernate
the local computer and you can use it with a slash F which will force the shutdown or the restart
or hibernate or whatever. Slash E will document the reason for an unexpected shutdown of a computer.
Slash F as I mentioned a little earlier is to force running applications to close.
When you're doing the shutdown if you use in combination with the slash S for shutting down or
a slash R for rebooting. So if you do shutdown space slash R space slash F it'll force a reboot.
So any applications that are open files that haven't been saved yet they'll close out and you'll
lose any unsaved data. Okay the slash M which I mentioned for the remote computer. Yeah it will
allow you to shut down a restart remote computer and the format for that would be slash M
followed by space followed by a double backslash and then the host name.
So if I wanted to restart a remote computer provided I have admin privileges on it and we do
shutdown space slash R space slash F to force it space dash M space the computer name and that'll
cause force the compute the remote computer to restart.
Now this command this next switch is the slash T and it's you and it's and it's followed by
numbers. So you would do slash T and then a time given slash T will is the time that's
is the timeout period basically so you would put it and it's in seconds so you would do slash T
30 for example if you wanted to perform the system shutdown or restart in 30 seconds which
actually if you don't provide a value the default is 30 seconds so in my previous example where
I decided to restart the remote computer since I didn't give it a specific amount of time
with the slash T it will default to 30 second a 30 second timeout period. Now if I had given it a
slash T space zero it will restart the PC the the minute I hit enter after sending the command.
Okay so there's more information here it says the valid range for the numeric value is
between zero and 350,360,000 seconds or 10 years and as mentioned the default if no time
value is given is 30 seconds. Now the slash F parameters applied when a value greater than
zero is specified for slash T so if you put zero you have to include the slash F to force it.
Now the slash C is for an optional shutdown method so if you've ever seen
when the shutdown command is invoked you get a message saying this computer will shut down
well you can actually type in your own message. Now the maximum characters are 127 characters
so you can say slash C space open quotes this computer will shut down and so on so number of
seconds please save all of your work close quotes and then they'll see that message the minute you
send that command over. And slash D which is followed by the U and a P both of which are in brackets
which are also followed after that by colon x double x and colon double y which is supposed to be
numeric values. What that does is it lists the reason code for the shutdown or the restart.
Now the s64.com page will include a table at the very bottom.
And if you actually run the shutdown command with the slash question mark option it'll list all
of these options along with the different values for the reason codes. So for example now to go
over the other ones the bracket the open bracket P close bracket will list a plan reason code.
The open bracket U close bracket will list a user defined reason code.
And if neither P nor U is specified the restart or shutdown is unplanned and the letter E in
unplanned is capitalized and embold to specify that's the letter that you'll see.
Now the double x and the double y values that were mentioned earlier the double x refers to the
major reason code which is between 0 and 255 and the double y value refers to the minor reason code
which is from 0 to 65535. Now for a user defined reason the major reason code must
be in the range 64 to 255. If not it'll be ignored and logged as unplanned.
Now there are also a couple of other switches here that only work with Windows 8 or greater.
So I'll first cover the ones that go from Windows 8 up and then there are two others that are
for Windows 10 only and more than likely whatever comes down the road.
From Microsoft so the ones that go from Windows 8 or greater are slash hybrid which performs a
shutdown of the computer and prepares it for fast startup and that will must be used with the
slash s option. And the other is the slash o which will go to the advanced boot options menu and
be started to computer and that must be used with the slash r option. Now the one that is the
that are specific to Windows 10 are slash soft which performs a soft shutdown restart or
log off depending on whether you whatever switch you use. And what this will do is this will
ask programs to close and wait for them to end. So it will ask them to close and I assume because
I've never used this but I assume that you perceive a prompt to save files and then it'll wait
until the application is completely closed out before it actually performs the selected command.
And then slash fw will combine with a shutdown option to cause the next boot to go to the
firmware user interface. Now I don't know if this is specific to the surface devices
but if anyone out there knows feel free to post a comment or record a follow-up episode to
this episode. So there you have it. Those are the that's the Windows shutdown.exe command.
Feel free to try it out in Windows if you use Windows at work. Play around with it.
Assuming that you have of course administrative privileges I think the only one that you might
actually be able to pull off is the shutdown dash L. Since that's just logging off your own
machine or your own account rather. But if you want to give it a try in ReactOS that would probably
be the best way to do it. You can load it up in virtual box or whatever virtual machine software
you prefer and give it a test drive there. So that's the shutdown command. I hope you enjoyed
this episode. If you have any questions or comments you can reach me via email at Claudio at
LinuxFacement.com or you can find me on mastodon as at ClaudioM at mastodon.xyz or xyz however you prefer.
Or record an episode or just place a comment there on once this episode is released.
Anyway, thanks for listening. Take care.
You've been listening to HackerPublicRadio at HackerPublicRadio.org. We are a community podcast
network that releases shows every weekday Monday through Friday. Today's show, like all our
shows, was contributed by an HPR listener like yourself. If you ever thought of recording a
podcast and click on our contributing to find out how easy it really is. HackerPublicRadio was
founded by the digital dog pound and the infonomicon computer club and is part of the binary revolution
at binrev.com. If you have comments on today's show please email the host directly leave a comment
on the website or record a follow-up episode yourself. Unless otherwise stated, today's show is
released on the creative comments, attribution, share a live 3.0 license.