For some example code, see Timing and timing out Unix commands and Timing Windows commands.
In reply to Re: Timeout on script by eyepopslikeamosquito in thread Timeout on script by hotshot