|
Answer» Hi,
I want to execute batch file. I am execute it from Java. I am executing this command: CMD /c start test.bat
Is there a way to limit the time it's running meaning that if the run CONTINUE over 1 hour for EXAMPLE to stop the run ?
Thanks I believe there is a way to pass variables to a batch file when you run it from the command line. If you can do that, you can construct a loop in the .bat file to only run for a certain amount of time.I am executing another program from the batch and the timeout is actually on this program so making a loop will not help.You could start a Stopwatch or Timer in your Java program then once the Stopwatch hits an Hour then it checks to SEE if the batch is still running, and if it is then kill that proccess
Don't know much about Java, but that's just my suggestion of how to do it.
|