Thierry,
If you have the PID of the process running "program.exe", _and_ if you have WMI (i.e. if you're Windows 2000, Windows NT 4.0 with the upgrade, or possibly others) you could check for processes having that PID as their ParentProcessId. OK, how do you do the check? Well, there are several possibilities: * See Dave Roth's book "Win32 Perl Scripting: The Administrator's Handbook" * See his examples at http://www.roth.net/perl/scripts/#wmi * See my Win32::ProcInfo (which I consider beta). I'll mail this on request, but I just discovered today that it can hang if you don't have enough privilege. * Assuming the PID of the process running "program.exe" is in $pid, the WQL query "select * from Win32_Process where ParentProcessId=$pid" should get just the processes you want. Any of the above (and a fair amount of "skull sweat" on your part - a Google search on Win32_Process will get you more information) should get you the PIDs you want. To save you a little work: the WMI attribute name for a PID is 'ProcessId'. Given these PIDs, I suppose you could do Win32::Process::Open on each of the PIDs in turn, waiting for each to exit. Tom Wyant [EMAIL PROTECTED]@listserv.ActiveState.com on 08/08/2002 04:19:04 AM Sent by: [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Controlling child process Hi, I have a problem related to child(ren) process control. It seems I always seem to have these kind of problems in windows.... I need to call an executable several times: let's call it "program.exe". I need to wait till the program.exe has finisihed it's work before calling it again, and again, ..... The problem is that program.exe launches an other program "sub-program.exe" and "program.exe" does not wait till "sub-program.exe" has finished it's job, so the control is returned to perl before "sub-program.exe" has finished processing. I've tried $Process-Wait(INFINITE), but this has no sense since I am then waiting for "program.exe" and not "sub-program.exe" to end. I really don't know how to handle this. I would basically like to wait till a program and all it's children have finished their work. I thought of try to get the PID of the children, but I don't know how to do this. Can anybody give me a tip? Thanks, Thierry _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs