Batch file to wait for other program to load/initialize, then execute command?

Posted by Jason N on Stack Overflow See other posts from Stack Overflow or by Jason N
Published on 2010-06-07T04:26:08Z Indexed on 2010/06/07 4:32 UTC
Read the original article Hit count: 359

Filed under:
|
|
|

I need some assistance writing what should be a fairly basic .BAT file.

I load my main program, but that program takes ~20secs to load and be initialized.

I have another command-line API I can execute to interact with this above program, but obviously until the above program is loaded and initialized there's no point in trying.

If the program isn't running the command-line API returns a string stating exactly this - otherwise it just works and exits. Easy.

So I want to wait until the above is loaded/initialized before firing my API command(s) at it.

I could place a sleep/wait in there, but I want something more solid. The ~20sec wait is not necessarily consistent.

Any way to execute the command-line API over and over until the response is satisfactory, then exit?

J

© Stack Overflow or respective owner

Related posts about batch

Related posts about batch-file