using System.Diagnostics;
Process exep = new Process(); //创建一个进程
exep.StartInfo.FileName = "calc.exe";//启动程序
exep.StartInfo.Arguments = "";//附加参数
FileInfo info = new FileInfo("d:\\test\\my.txt");
exep.StartInfo.WorkingDirectory = info.Directory.ToString(); //工作路径 d:\\test
exep.StartInfo.CreateNoWindow = false;
exep.StartInfo.UseShellExecute = true;
exep.Start();
// exep.WaitForExit() ();//关键,等待外部程序退出后才能往下执行
//int ec = exep.ExitCode;
【语言-c#】C# 启动exe
最新推荐文章于 2025-04-10 11:55:20 发布