Search H3r3

Tuesday 11 June 2013

How to shutdown, restart, logoff using command promp

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
OR
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”




OR 
USE THIS WAY

Microsoft Windows offers several ways to shut down or restart your computer, one of which is via the command prompt.
To access the command prompt window from Vista or Windows 7:
  1. Go to the Start menu
  2. Type cmd in the Search field
  3. Press Enter
On a Windows XP computer:
  1. Click the Start menu
  2. Choose Run
  3. Type cmd
  4. Press Enter
From an open command prompt window, you can type shutdown, and then the option you wish to execute.
To shut down your computer type: shutdown /s
To restart your computer type: shutdown /r
To log off your computer type: shutdown /l
For a complete list of options type: shutdown /?



screen shot

REFER AJEETH SARAVANA DASS