The shutdown command in windows is used to start, stop, and log off the machine in windows.

This can be used in batch and command line

Syntax

shutdown [options]

Options -s: shutdown the machine -r : restart the windows machine -l : logoff the current user from windows -h : power off the windows in hibernate mode -i: It opens the screen in interactive UI mode -f: forcibly shutdown of the machine immediately by the exit from programs -t seconds: It waits for seconds before shutdown machine, seconds=0 means shut down immediately. -m: hostname or machine to apply shutdown command. /? : list out all options for the shutdown command

How to restart shutdown windows with command line

Following are steps to do a reboot in windows.

  • Open Start menu, type cmd in search run field
  • It opens the command line terminal
  • shutdown -r command to restart windows
  • shutdown -s command to shutdown windows
  • shutdown -l command to logoff windows
  • shutdown -r command to restart windows

How to restart logoff from batch file for another machine

You can do a batch file with the shutdown command

Run below batch file to restart or reboot windows from the command line run.bat:

shutdown -r -t 0 -f -m \\johnwindows

In order to log off in windows, Please run the below command run.bat:

shutdown -l  -m \\johnwindows