From 2bdf37bae40dd37a90363679be3245cad797769a Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 24 十月 2023 17:35:19 +0800 Subject: [PATCH] 测试TB生成MPT功能 --- ExportMap/cs/Tools.cs | 22 +++++----------------- 1 files changed, 5 insertions(+), 17 deletions(-) diff --git a/ExportMap/cs/Tools.cs b/ExportMap/cs/Tools.cs index 4b7dc85..fc981b3 100644 --- a/ExportMap/cs/Tools.cs +++ b/ExportMap/cs/Tools.cs @@ -377,35 +377,23 @@ /// 鎵ц鍛戒护 /// </summary> /// <param name="list">鍛戒护闆嗗悎</param> - public static string ExecCmdForWin(List<string> list, bool noWin = false) + public static string ExecExe(string exe, string args, bool noWin = true) { string str = null; Process p = null; try { p = new Process(); - p.StartInfo.FileName = "cmd.exe"; + p.StartInfo.FileName = exe; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = noWin; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; + if (!string.IsNullOrEmpty(args)) p.StartInfo.Arguments = args; + p.Start(); - - StreamWriter si = p.StandardInput; - StreamReader se = p.StandardError; - - LogOut.Info("cmd = " + string.Join("锛�", list)); - si.AutoFlush = true; - foreach (string cmd in list) - { - si.WriteLine(cmd); - } - si.WriteLine("exit"); - - str = se.ReadToEnd(); - se.Close(); - si.Close(); + p.WaitForExit(); } catch (Exception ex) { -- Gitblit v1.9.3