Restart an application by itself

后端 未结 10 638
醉话见心
醉话见心 2020-12-13 02:46

I want to build my application with the function to restart itself. I found on codeproject

ProcessStartInfo Info=new ProcessStartInfo();
Info.Arguments=\"/C          


        
10条回答
  •  无人及你
    2020-12-13 03:25

    This worked for me:

    Process.Start(Process.GetCurrentProcess().MainModule.FileName);
    Application.Current.Shutdown();
    

    Some of the other answers have neat things like waiting for a ping to give the initial application time to wind down, but if you just need something simple, this is nice.

提交回复
热议问题