管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2023-10-24 2bdf37bae40dd37a90363679be3245cad797769a
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)
            {