Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Two process one after another using C#?

Tags:

c#

process

I have a application which will open a two microsoft ppsx file one after another. for that i have used process object to run the files. mention bellow

Process process = Process.Start(@"E:\test\test.ppsx");

I need to run the files in such a way that after finishing the first file ,second file should run automatically. can some one suggest me how can achieve that.

like image 667
Arup Avatar asked Mar 24 '26 08:03

Arup


1 Answers

You can use WaitForExit method to wait to end process (Something like this):

var process1 = Process.Start(...);
process1.WaitForExit();

var process2 = Process.Start(...);

or subscribe into a Process.Exited event and execute another process after the first one. Check this for your reference.

like image 123
roybalderama Avatar answered Mar 25 '26 20:03

roybalderama



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!