process打開應用程序的時候,最好要指定工作目錄,否則會出現一些錯誤
private static void StartRobot(string path, string exe) { Process myProcess = new Process(); try { myProcess.StartInfo.UseShellExecute = false; myProcess.StartInfo.FileName = Path.Combine(path, exe); myProcess.StartInfo.WorkingDirectory = path; myProcess.StartInfo.CreateNoWindow = true; myProcess.StartInfo.Verb = "RunAs"; myProcess.Start(); } catch (Exception e) { Console.WriteLine(e.Message); } }