This page is edited from the 1cmdfaq.txt faq-file contained in
my tscmd.zip
command line interface (CLI) collection. That zipped file has much
additional material, including a number of detached .cmd script
files. It is recommended that you also get the zipped version as a
companion.
Please see "
The Description and
the Index page" for the conditions of usage and other such
information.
71} How can I reboot my computer from a command line script?
Warmboot in the old MS-DOS terminology. In XP this is really simple.
@echo off
shutdown -r
On Windows 7 and Windows 10
@echo off
shutdown /r
Or, a bit more fully
@echo off & setlocal enableextensions
set /p ask_=Restart, are you sure [y/N]?
if /i not "%ask_%"=="y" if /i not "%ask_%"=="yes" goto :EOF
@shutdown -r -f -c "Shutting down and restarting from a command line script"
endlocal & goto :EOF
For an explanation of the arguments apply
shutdown -?
On a multi-user system you may wish to check
if anyone else is logged on
before rebooting.