How can I emulate a finite process tree in C # /. Net

We have a web application that should run other processes. Typically, these processes are batch files that run a number of other processes. Sometimes we need to kill a batch file process that is running, and for this we need to kill him and his children.

What is the best way to do this in .Net?

+4
source share
3 answers

For me, this solution works well.

(It applies only to Windows: P / Invoke is used to invoke unmanaged APIs)

+3
source

In an earlier case, the process tree question SO community did not vote for any answer. Good luck this time!

+1
source

This is an old thread, but a post here if someone else is looking for an answer

  1. To run a batch file in administrator mode: how to use a C # run batch file as administrator to install Windows services

  2. To programmatically destroy a process tree: programmatically destroy a process tree in C #

combining them should do the job.

Hope it helps.

0
source

Source: https://habr.com/ru/post/1286191/


All Articles