This is one of my favorite tricks, shutting down my Windows XP machine with one simple line of code!
This might not seem necessary since the power button is tucked neatly inside the Start Menu, but this trick has a few more uses. Not only can you use this on your machine, but on network machines as well – as long as you have administrative access! You can also restart machines, set comments (the reason for the shutdown), specify time and more!
List Of Shutdown Command Switches
| No Switches | Display information about the shutdown command, same as typing “-?” |
| -i | Display a GUI. It must be the first switch |
| -l | Log off the user (This cannot be used on a remote machine: “-m” switch) |
| -s | Shutdown the computer |
| -r | Restart the computer |
| -a | Cancels a system shutdown already in progress |
| -f | Forces running applications to close without warning |
| -m \\computername | Instruct a remote computer to shutdown (can be used with the restart & abort switches) |
| -t xx | Set a given time for shutdown, in seconds |
| -c “comment” | Shutdown comment (maximum of 127 characters) |
| -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) |
How To Use Shutdown Switches:
You don’t have to use them all, but the switches you do use must be in the following order:
shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
How To:
Open the command prompt: Windows Key + R then type the command below and hit OK:
cmd
This will open the command prompt. Now we can play!
Note: You could type the shutdown command directly into the Run dialog. I don’t advise this. If there is a typo or error, you won’t know. There is no information given!
Shutdown Local Machine
This only takes a couple of keystrokes. Type the code below and hit OK:
shutdown -s
“shutdown” tells the computer what command we want to execute and the “-s” switch tells it what to do, which is to shutdown!
Specify Time
shutdown -s -t 60
Now we have added the “-t” switch and a variable, which in this case is “60″. This number is the number of seconds before the computer is shutdown. A dialog will open and display a count down timer!
Give Us Some Info!
shutdown -s -t 120 -c "You better finish, because I shut you down foo!"
The “-c” switch will allow you to give the user some information for the reason of the shutdown.
Shutdown A Remote Computer
shutdown -s -m \\desktop -t 45
I really like this one! The “-m” switch will allow you to shutdown a remote machine, in this case, a computer named “desktop”. For this to work, you must have administrative access to the computer! To see of you do, hit Windows Key + R then type the computer’s name, i.e.:
\\desktop
If you can connect to it, you will be asked to log into the machine with a user name and password. Once confirmed, a window will open displaying the directories available to you. Now you know you can shut it down remotely.
Cancel Shutdown
Let’s say that you need to cancel a shutdown in progress. Go to the computer in question, hit Windows Key + R then type command below:
shutdown -a
This will abort the shutdown, assuming there is a counter and it hasn’t reached zero yet!
Ah! Abandon Ship!! That could come in handy.
I use it all of the time – especially if I’m feeling too lazy to walk across the room to shut down a machine!
I use this to create a great big SHUTDOWN icon on the computer at my parent’s house – so they would stop pulling the plug out of the wall to shut down the computer.
Oh man, that is hilarious! I remember when we used to unplug our 386 too!
That is just to much! I suppose if it’s right on the screen they may actually use it once in a while…
ooh i’ve read about this before…
but whenever I try to shutdown a remote computer, it doesn’t do anything. It works when I’m shutting down my laptop though.
I typed in //mainframe (that’s the name of the computer) and it didn’t ask for a username/password but instead just opened the directories. How would I set my laptop to become an administrator for that computer?
Also is there anyway to turn a computer on remotely? I use my family’s desktop for storage and my parents always turn it off after they use it and I’m too lazy to turn it on to get files on the network drive
Thanks in advance!
sorry for the double comment but I’m not sure if you’ve seen this…
1) How do i set my laptop as an administrator for the desktop? (check comment above)
2) Is there a way to turn a computer on remotely?
I’m not 100% sure….
Try making sure they’re both on the same workgroup and make accounts on both machines that have passwords…
I know that you can access files on the other machine using:
//mainframe/c$i use this and speard it arround the internet so people think they got big virus
email me at [email removed] because i need some hints on how to shut down computers on a lan server (such as at School)
So how do you run a shutdown from a file? Can’t figure out how
Check this post out: Windows Tip: Shutdown Your Computer With A Batch File
Let me know if you need more help!
hey i had made a batch file with the command shutdown but i want to schedule that batchfile in a timer everyday without my approval it should shutdown or restart from a particular time say from 1:00pm to 4:00pm it should only restart the computer………………….
Do anyone know that how to scheduled the timer……………….
Chris, I wrote about scheduling a shutdown with a batch file. Let me know if you need any help!