【发布时间】:2015-10-04 15:29:54
【问题描述】:
我这里有一个代码,它将启动一个进程,当再次按下它时,它将终止当前进程并启动一个新进程(重新启动)。
Private Games As New Dictionary(Of String, Process)
Private Sub GS1_Click(sender As Object, e As EventArgs) Handles GS1.Click
Dim gameservercfg As String = GameServer1.Text
Dim Key As String = gameservercfg.ToUpper
If Games.ContainsKey(Key) Then
If Not Games(Key).HasExited Then
Games(Key).Kill()
End If
Games.Remove(Key)
End If
Dim psi As New ProcessStartInfo
psi.FileName = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "GameServer.exe")
psi.WorkingDirectory = System.IO.Path.GetDirectoryName(psi.FileName)
psi.Arguments = gameservercfg
Games.Add(Key, System.Diagnostics.Process.Start(psi))
End Sub
我想做的是,当gameserver.exe自行崩溃时,如何让它自动重启?
【问题讨论】:
标签: vb.net process.start application-restart