Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start process and allow caller to end without waiting for process to finish

Tags:

c#

process

I need to start a process from a C# console app and then allow the console app to finish/end without waiting for the process/thread to finish.

How do I do this?

like image 318
77vetter Avatar asked Nov 13 '22 06:11

77vetter


1 Answers

You need to avoid making your new process a child process of the current process:

ProcessStartInfo sinfo = new ProcessStartInfo();
sinfo.UseShellExecute = true; // Do not wait - make the process stand alone
sinfo.FileName = "PathAndNameofExe";
Process.Start(sinfo);
like image 185
Hans Karlsen Avatar answered Nov 14 '22 22:11

Hans Karlsen