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 to 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
The 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 commandtorestartwindowsshutdown -s commandtoshutdownwindowsshutdown -l commandtologoffwindowsshutdown -r commandtorestartwindows
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