C:\_G\WWW\~ELISANET\INFO\tscmd071.html
<http://www.elisanet.fi/tsalmi/info/tscmd071.html>
Copyright © 2003- by Prof. Timo Salmi  
Last modified Fri 30-Nov-2018 11:09:09

 
Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
 

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.

References/Comments:
  hh ntcmds.chm::/shutdown.htm [You can't use this unless you have the ntcmds.chm file]

[Previous] [Next]

C:\_G\WWW\~ELISANET\INFO\tscmd071.html
C:\_G\WWW\~ELISANET\FTPCMD\TSALMI.CMD /tscmd071
http://www.elisanet.fi/tsalmi/info/tscmd071.html
file:///c:/_g/www/~elisanet/info/tscmd071.html