Hi @deskcheck1-0579 ,
You can start the process and check when it exits by using Process Class.
The following code displays the exit time and exit code at the end of each executable file by raising Process.Exited event.
Sub Main()
Dim myProcess1 As Process = Process.Start("SWAT_123.exe")
myProcess1.EnableRaisingEvents = True
AddHandler myProcess1.Exited, AddressOf ProcessExited
Dim myProcess2 As Process = Process.Start("SWAT_456.exe")
myProcess2.EnableRaisingEvents = True
AddHandler myProcess2.Exited, AddressOf ProcessExited
Dim myProcess3 As Process = Process.Start("SWAT_789.exe")
myProcess3.EnableRaisingEvents = True
AddHandler myProcess3.Exited, AddressOf ProcessExited
Console.ReadKey()
End Sub
Friend Sub ProcessExited(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myProcess As Process = DirectCast(sender, Process)
MsgBox("The process " & myProcess.StartInfo.FileName & " exited at: " & myProcess.ExitTime & "." & System.Environment.NewLine & "Exit Code: " & myProcess.ExitCode)
myProcess.Close()
End Sub
Hope the code above could be helpful.
Best Regards.
Jiachen Li
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.