首页 > 技术文章 > WPF 重新启动该程序

hz1234 2016-07-27 14:12 原文

// Restart current process Method 1  
System.Windows.Forms.Application.Restart();  
Application.Current.Shutdown();  
  
// Restart current process Method 2  
System.Reflection.Assembly.GetEntryAssembly();  
string startpath = System.IO.Directory.GetCurrentDirectory();  
System.Diagnostics.Process.Start(startpath + "\\xxx.exe");  
Application.Current.Shutdown();  
  
// Restart current process Method 3  
Process p = new Process();  
p.StartInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory + "xxx.exe";  
p.StartInfo.UseShellExecute = false;  
p.Start();  
Application.Current.Shutdown();  

 

推荐阅读