Friday, November 6, 2009

create batch file for shutdown and restart

This will show you how to create batch file to shutdown or restart your pc, also you can schedule it by any given time, follow these steps.


Create batch file for shutdown (with shutdown message box)

  • First create new text document
  • Now inside text document type c:\windows\system32\shutdown -s -f -t 300 (the value 300 is 5 min, (60 x 5) if you want you can raise or reduce the value or put 00 for immediate shutdown)
  • Now save the file as with the extension of .bat (ex- shutdown.bat)
  • Important - make sure you uncheck "hide extensions for known file types" in folder option before naming the batch file. otherwise it wont create batch file,it will create only text file named as shutdown.bat.txt

Create batch file for restart

  • First create new text document
  • Now inside text document type shutdown -r -f -t 300 (if you want restart immediately without countdown set value to 00)
  • Now save the file as with the extension of .bat (ex- restart.bat)

Create schedule for shutdown

  • Open schedule task folder (start > run > type tasks > press enter)
  • Double click add schedule task
  • Click next
  • Click browse button
  • Specify the shutdown.bat file we created
  • In the name field type anything, and select the action under "perform this task"
  • Now proceed with the schedule task, and click finish at the end.

Note - to immediately cancel shutdown or restart job, type shutdown.exe -a in run command and press enter.

No comments:

Post a Comment