How to find the child processes associated with a PID?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello everyone,

Im launching a cmd line script from a c# application with:
cmd /c randomscript.cmd

I save the PID so i can later kill it but, since the "randomscript.cmd" launches other applications, the application doesnt actually stop when i kill it (because the other applications launched by my randomscript.cmd).

Basically, ive found that i should look for all the childs associated with a given PID so i can then kill them.

Does anybody know how i can do this?

I have an example for getting the parent id for a given child but thats exactly the opposite from what i want to achieve: i want the CHILD for the given Parent!

Thanks in advance!
Luís Silva


View the full article
 
Back
Top