jcl,

exec() currently allows me to launch a process synchronously (Mode = 1) or asynchronously (Mode = 0). But if I do it asynchronously, I cannot track the result.

Consider this scenario:

Suppose I want to run a batch of 100 zorro scripts, but I only want to run four or eight at a time (due to my processor having four cores / eight logical threads, and for some reason, the scripts are single-threaded only). In this case, I would ideally like to launch a master zorro script:
* First, it launches four zorros.
* Next, it tracks to see which of the processes finished, maybe once a second.
* Upon one process completion, it launches the next zorro.
* Continue until all 100 scripts are completed.

For this to work, I would need some sort of handle to track each process, such as to detect its status and return code (if applicable).

Can exec() be enhanced to do this?

In the meantime, I suppose I do have two feasible workarounds:
* Run four synchronous batch files simultaneously, each launching zorro over and over again.
* Use the WinAPI directly to create and track process handles.

Thanks,
Andrew