« | Home | »

reboot using the command line or script

By Martin English | January 1, 2008

If you want to reboot your Windows XP or Vista machine from a .bat file, here is the command to do it:

shutdown -r -f -t 0

LifeHacker recently reported this as a fast shutdown command.

shutdown -f -t 0

Be warned – the -f option forces apps to close even if you have not saved your work document!

There is also a command to cancel an impending reboot. This can be helpful if the system initiated it after an update.

shutdown -a

So the -f forces close, -r reboots, -t 0 is how long in seconds before reboot or shutdown and -a cancels it. You can log off a user with -l and -m lets you hit up a remote machine!

Ask The Admin uses scripts with outlook here. Pretty nifty stuff, eh?

Shutdown

Allows you to shut down or restart a local or remote computer. Used without parameters, shutdown will logoff the current user.

Syntax

shutdown [{-l|-s|-r|-a}] [-f] [-m [\\ComputerName]] [-t xx] [-c "message"] [-d[u][p]:xx:yy]
Parameters

-l : Logs off the current user, this is also the defualt. -m ComputerName takes precedence.

-s : Shuts down the local computer.

-r : Reboots after shutdown.

-a : Aborts shutdown. Ignores other parameters, except -l and ComputerName. You can only use -a during the time-out period.

-f : Forces running applications to close.

-m [\\ComputerName] : Specifies the computer that you want to shut down.

-t xx : Sets the timer for system shutdown in xx seconds. The default is 20 seconds.

-c “message” : Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters. You must enclose the message in quotation marks.

-d [u][p]:xx:yy : Lists the reason code for the shutdown.

If you prefer hibernation, this is the (unintuitive) command I found:
rundll32.exe PowrProf.dll, SetSuspendState

Topics: Code, Microsoft, Productivity | No Comments »

Share on FriendFeed Reading: reboot using the command line or scriptTweet This

Comments

  • Subscribe to my RSS feed ?



  • Recent….


    • follow me on Twitter
    • www.flickr.com
      This is a Flickr badge showing public photos and videos from martin english (AUS). Make your own badge here.
    • Meta