Shutdown and restart/reboot Windows from the command line.
:: To shutdown the current machine:
shutdown /s
:: To shutdown the current machine force-closing all apps:
shutdown /s /f
:: To restart the current machine immediately:
shutdown /r /t 0
:: To hibernate the current machine:
shutdown /h
:: To log off the current machine:
shutdown /l
:: To specify a timeout in seconds to wait before shutting down:
shutdown /s /t <seconds>
:: To specify a comment for the shutdown reason:
shutdown /s /c "<reason>"
:: To abort a shutdown sequence whose timeout is yet to expire:
shutdown /a
:: To shutdown a remote machine:
shutdown /m <\\hostname>
:: ---
:: To force apps to close and to restart the local computer after a one-minute delay, with the reason Application: Maintenance (Planned) and the comment "Reconfiguring myapp.exe":
shutdown /r /t 60 /c "Reconfiguring myapp.exe" /f /d p:4:1
:: To restart the remote computer myremoteserver with the same parameters as the previous example:
shutdown /r /m \\myremoteserver /t 60 /c "Reconfiguring myapp.exe" /f /d p:4:1