Batch File Restart or Shutdown PC

Wednesday, December 9, 2009


Open Notepad and paste the following codes then save it as .bat
works on XP, Vista, and Win7




@echo off
echo Do you want to Shutdown or Restart Windows?
echo ==================================================
echo = Press [S] To Shutdown Windows =
echo = Press [R] To Restart Windows =
echo = Press [N] To Exit =
echo ==================================================
echo Please Save all files before you continue.

:selc

set Choice=
set /P Choice=""

if '%Choice%'=='s' goto SHUTD
if '%Choice%'=='r' goto REST
if '%Choice%'=='n' goto can
echo "%Choice%" Wrong input Please try again.
goto selc

:SHUTD
echo Windows is shutting down.....
tree
shutdown -s -t 00 -f
goto ex

:REST
echo Restarting Windows.....
dir/s
shutdown -r -t 00 -f
goto ex

:can
echo TO EXIT
PAUSE

:ex
exit

0 comments

Post a Comment