1
我在这里有一个代码将启动一个进程,当再次按下它将杀死当前进程并启动一个新的(重新启动)。VB.net自动重新启动应用程序
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崩溃自己?