![]() So, you can use Timer as a 'stop watch' to find the start and finish times of an operation. Timer keeps track of the seconds to at least seven decimal places of accuracy. VBS - Self Writing Shutdown: this is a cool script that I put together in like. You can use it to create a command that, when run, will shut. The Timer function returns the number of seconds that have passed since midnight (12:00:00 AM). BAT file that runs the program and then shuts Windows down, but I don't always need to shutdown when I finish using the program. This is the free text editing program that comes with every version of Windows. Also, I want to run the whole thing just once in a time constrained manner, no loop in this case. On those occasions, I would like to run a VBScript that will watch for that program to close, and when it does, will shut down Windows. If you were to do what you have shown above, you would have to put all of your code within the loop and what would happen if something in the loop where to hang for some unknown reason like blocking IO? The loop would never cycle because it would never reason the end of the iteration and the loop test would never force the termination of the script. This loop doesnt work for some reason, any advice on how to fix this simple problem is apreciated. I don't want to delay execution of anything, I want it to proceed but be killed if it takes longer than X seconds. I don't want the command line to get any longer either really as vbs is inconvenient enough having to type "cscript scriptname options." ![]() One reason being, I can't rely on a user to always run a script with the //T:x option and I need the script to contain a default timeout if non is specified. ' -s shutdown, -t 120 2 minutes, -f force programs to close strShutdown 'shutdown.exe -s -t 120 -f' set objShell CreateObject('WScript.Shell') objShell.Run strShutdown, 0, false 'go to sleep so message box appears on top WScript.Sleep 100 ' Input Box to abort shutdown intShutdown (MsgBox('Computer will shutdown in 2 minutes. ShutdownTimerClassic.exe and add the arguments you want after this: Argument Description /SetTime
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |