c#启动exe文件

最常见的ProcessStartInfo启动

ProcessStartInfo info = new ProcessStartInfo();
info.FileName = @"路径\exe的文件名";
info.Arguments = "";
info.WindowStyle = ProcessWindowStyle.Minimized;
Process pro = Process.Start(info);
pro.WaitForExit();

结束启动的exe的进程

Process[] allProgresse = System.Diagnostics.Process.GetProcessesByName("exe的进程名");  
foreach (Process closeProgress in allProgresse)  
{  
    if (closeProgress.ProcessName.Equals("exe的进程名"))  
    {  
        closeProgress.Kill();  
        closeProgress.WaitForExit();  
        break;  
    }  
}

 

 

 

posted @ 2023-07-04 10:50  txwtech  阅读(755)  评论(0编辑  收藏  举报