Sunday, September 20, 2015
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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsUiWol16mSzfcwge9-ulqKHcIPPGmdwA9KgRKG0K6c5kIkR9YEWO7f892w6MbMBG4Gy2LdovSxSu3iCFVDIN_diWJNLaT2aZAXUB7JYq2Dqa-QT_5ELOlq_0-H3Li3Qeri2E2eyS1i-wO/s400/Desktop.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYILTQ1mdBHkUqZcP7iEUySYMNx9RTVbXT05rT5AGwvCBcIy0yifeEOTKkdr3PH6Rsf63x7nplFzLDZ4drKaBW557pgkXFmvzHWoqEgMP0wOzumYgxTyhQg4BhsE-gihUpP6WsIFsDG9hI/s320/inputbox.png)
Labels:
VB
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment