2 Apr 2013

VBS Shutdown Timer

When running time comsuming processes I often wish to shutdown automatically after a given time. There are several applications on the internet but I was not really happy with the ones I found. So, I put together a really small VB-Script which in fact does the job perfectly.

Dim Shell : Set Shell = CreateObject("WScript.Shell")

argument_t = inputbox("Time in Seconds:", "Shutdown", "3600")

Shell.Run "C:/Windows/system32/shutdown.exe -f -s -t " & _
          argument_t, 0

MsgBox "Press OK if you want to cancel the Shutdown..", _
       vbInformation + vbOkayonly, "Cancel Shutdown"

Shell.Run "C:/Windows/system32/shutdown.exe -a", 0

I put the vbs file on my disk and a shortcut to it on the Desktop. You can choose the time until shutdown with an input box.



1 comment :

  1. Awesomeness!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    ReplyDelete