How to shutdown, restart, logoff using command prompt?

Windows provides a builtin command to shutdown, restart as well as logoff a user from the command promptne. This and many other options are provided by the “shutdown” command. In order to find out more options of any command, type :

shutdown /? – command name followed by a forward slash and a question mark.

in Command Prompt ( WIN + R » cmd – here are some more Windows Keyboard shortcuts. You can run any command from Command Prompt or typing the command with full option into the RUN Dialog ( WIN + R ) The main use of all these commands come in batch files and task scheduling. All of these commands are pretty easy to use, please read the article completely before complaining ;)

Basic form of “shutdown”

The most basic form of the command is :

shutdown -OPTION
shutdown /OPTION

Both perform the same thing – execute shutdown command with option OPTION. OPTION can take many values, only the ones of interest to us are mentioned here.

-l – Logs off the current user
-s – Shutdown the computer
-r – Restart the computer

-a – Aborts a current shutdown command execution

-t XX – if this is added with any of the above ones, you can specify after what time ( XX seconds ) the system should execute the OPTION.

A Simple example and a Screenshot

Here the OPTIONs specify that shutdown command should shutdown the command after 120 seconds.

RUNning “shutdown” command with options -s -t 120

shutdown -s -t 120

The screen result will be something like this :

Before shutdown, the logged in user is warned about the event and the time frame.

Canceling a shutdown

If you have given the time parameter -t XX you will have sometime before the command kicks you out. In that time, if you want to cancel the event just type :

shutdown -a -Abort a shutdown

shutdown Aborted – notification

Add a message

You can add a custom message with shutdown so that, instead of the time frame warning, the user will be presented with your message.

shutdown -s -t 120 -c “You are so screwed”

will present the user with the message – “You are so screwed” as below :

Custom message with “shutdown”

More about shutdown on Microsoft KB | Built in parental control in Windows XP



Tagged with: , ,
Posted in Windows
37 comments on “How to shutdown, restart, logoff using command prompt?
  1. If you want to obtain much from this article then you have to apply such techniques
    to your won website.

  2. I am regular reader, how are you everybody? This piece of writing posted at
    this website is really nice.

  3. It’s amazing designed for me to have a web page,
    which is helpful designed for my know-how. thanks admin

  4. I am really happy to glance at this web site posts which includes plenty of
    useful facts, thanks for providing these information.

  5. Johnd892 says:

    Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with a few pics to drive the message home a little bit, but other than that, this is great blog. An excellent read. I will certainly be back. caeffabeakeb

  6. I like the valuable info you provide in your articles. I
    will bookmark your weblog and check again here frequently.

    I am quite sure I will learn many new stuff right here!
    Best of luck for the next!

  7. Everything is very open with a really clear explanation of the issues.
    It was definitely informative. Your site is
    useful. Thanks for sharing!

  8. Hey there, You’ve done an incredible job. I’ll certainly
    digg it and personally suggest to my friends. I’m sure they’ll be benefited from this website.

  9. Hi there everyone, it’s my first go to see at this site,
    and post is truly fruitful in favor of me, keep up posting these articles or reviews.

  10. I’m not that much of a internet reader to be honest
    but your sites really nice, keep it up! I’ll go ahead and bookmark
    your website to come back later. Many thanks

  11. Hey! I know this is kinda off topic but I was wondering which blog
    platform are you using for this website? I’m getting fed up of WordPress because I’ve had problems with hackers and I’m looking
    at alternatives for another platform. I would be great if
    you could point me in the direction of a good platform.

  12. Vous faîtes continuellement des articles passionnants

  13. These collars should only be used while actively trainijng or exercising your canine.

    Cana – Dog Racing Dog Colllars can be used for dogs who need to be temporarily tethered as they are extremely durable and hzve nnot parts which ccan break or come apart
    if the dog tugs or pulls against a tether.

    But overall, it’s still one off the best GPS pet locators annd it’s also great for training hunting dogs too, thanks to soe of the featues listdd in the
    review linked above.

  14. ariel says:

    How close is another computer not my PC

  15. Yoshandan says:

    Hi, i just try it, but command prompt displays the message as “Access deined” then how to solve this problem and shutdown the system.

  16. jalpa says:

    how to cancel command which we give a time

  17. Galip Ermis says:

    The batch file is simple, it contains only 1 line:

    shutdown -s -t 5

    Run it with the highest privileges under taskscheduler.

  18. Gheorghita says:

    Why is my laptop so laggy all of a sdduen?Just yesterday I restored my Sony PCG-FXA47 because it was running slowly, after I restored it, I uninstalled all of the programs that I did not need. It was running very fast, but the next day, all it was doing was lagging. I am running Windows XP Home Edition SP2. I am going to try a registry fix, but I have already done a disk cleanup, disk defragmentation, and I have deleted all offline content, deleted all of the history and cookies, deleted temporary files, and manged my startup items. I don’t want to do a RAM upgrade just yet, but I want to know if there is anything else that I can do to stop my laptop from lagging. I have tried programs like Tune Up Utilities 2009, it did help me a little, but my laptop started lagging uncontrollably the next day. I haven’t tried a registry clean just yet, but I want to know if it would make a significant difference. All the programs that I have on my laptop combined take up no more than 100 Megabytes. I am running a Sony PCG-FXA47 256mb of RAM 20gb hard drive(I know it’s not much) 32-bit Windows XP Home Edition SP2 1GHz AMD Athlon 4 ProcessorIt cost 1,000 bucks in 2001!!!

  19. kelvein says:

    i want to ask one little thing, how to hack school computer include all program..i used all type of cmd , but is is useless….

  20. Alan says:

    How can I put my pc in standby mode?

  21. Just to add so everyone can find the info on this page – use shutdown – i for remote reboot. It provides a GUI interface

  22. For shutdown at 9:00pm

    “at 21:00 shutdown -s”

    without Quoutes..!!

  23. Noel says:

    Hi All,

    To shutdown a computer via a network or lan.. click stat / run / shutdown -i

    Enter the compuer name. Select the option from the drop down menu “shutdown” “Restart” or “Logoff” set the time to show the message. then have the message to what ever you like then press ok.

  24. Rustam Kumar Singh says:

    Dear Leam it work in windows 7 please follow the instruction it helps in all the command
    shutdown -r
    shutdown -s
    shutdown -l

  25. Liam says:

    i did the shutdown trick and tried to abort it but it didnt work. maybe its because i windows 7.

  26. Ajith says:

    You are right, PS tools does have that. I haven’t tried this on another Win machine, but the doc says that.

  27. The App says:

    I don’t think you can run this command on a remote computer. I think pstools can help you acheive this. PSTools lets you run commands on remote computers.

  28. Jarret says:

    Great Job! I have a bone deformity in my mouse hand and due to the pain that come after an extended period of time with a mouse, this makes my life just a little easier. Thanks so much!

  29. Eddie says:

    please send me an instruction on how to shutdown other user’s desktop using command sign.

  30. Ajith says:

    Hi Karry,
    that’s true. Even I was thinking about changing it. Will change it soon :) .

  31. Hi man, I like your blog but you should really change the blog template, this one is not very good.

  32. Albert says:

    I’m trying to test this batch file but not working, can somebody how I can change it to work:

    %rightnow% = time /t
    %starttime% = “12:00 AM”
    %endtime% = “05:00 AM”

    rem “trying to find out if current time is between 12 and 5 AM”

    if “%rightnow” geq “%startime” and %rightnow% leq %endtime%

    echo “between 12 and 5 AM”
    echo “it is okey”


  33. Ajith says:

    Hi Phalla,
    can you please tell me the specific error shown when you type the command.. or better can you add a screen shot of the command prompt when you do this.

  34. Phalla says:

    i know all this command but i cannot restart a pc in network. why? All you detail about this command are useful but i still cannot do it.

  35. Ajith says:

    Hi Arne please try the IP of the computer you are trying to shutdown. Use IP.IP.IP.IP instead of \\XXXXX The IP of the remote computer can be found easily by opening the command prompt and then typing “ping \\XXXXX” You can see the IP there. Please tell me if your problem have been resolved.

  36. Arne says:

    Hello! When i am using any commands on my computer it works great, but if i’m trying to use it on a computer in a LAN it doesn’t word, it just syas that it can’t find the network adress.
    I’m typing in the following command:
    shutdown /s /m \\XXXXX /t 005

    and i’ve checked that the computer name is correct.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>