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 the command line

Following are steps to do a reboot in windows.

  • Open the Start menu, type cmd in the 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 the below batch file to restart or reboot windows from the command line run.bat:

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

To log off in windows, Please run the below command run.bat:

shutdown -l  -m \\johnwindows