|
Answer» Hello, I'm running a batch file that starts an pplication in windows xp, then wait untill the program is finsihed, and then starts another APPLICATION. My batch file has about 1000 lines, which each line starts an application, waits, and when it's done, WENT to the next line of command. I'd like to know if there is a way to set maximum time on the application that is running. For example, when an application starts, I like the application run for maximum 2 minutes. After two minutes, weather it's finished or not, I want the program to END, and the batch file starts the application on the next line in the batch file. I'd be apprecaited if you could help me with that.
Regards, DavoodAt first this SEEMED rather simple, the start command offers a /wait parameter but no wait interval and no self-destruct mechanism. Then the scheduler seemed to offer promise, but not all the fields are available at the command line or even with a script.
Third party software may offer a solution, Google for possibilities or you could do this with a script.
1) load up all 1000 jobs (incl. run time parms) into an array 2) submit first job in array 3) monitor the task list; if job finishes before 2 min max, submit next job from array; if job goes over 2 min max, terminate the job and submit next job from array.
One thing to consider is your definition of time. Are you talking about CPU time or wall clock time? Scripts have access to both but windows stores DATE and time fields in UTC format adding to the complexity.
Let see, 1000 jobs, 2 min each max, multiply, divide, hmmm, 33 hours and some odd minutes.
Good luck.
|