管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2023-10-23 2fd93008d2ce0052353e5016f2c15d1890ffd2e6
ExportMap/cs/Tools.cs
@@ -374,6 +374,55 @@
        }
        /// <summary>
        /// 执行命令
        /// </summary>
        /// <param name="list">命令集合</param>
        public static string ExecCmdForWin(List<string> list, bool noWin = false)
        {
            string str = null;
            Process p = null;
            try
            {
                p = new Process();
                p.StartInfo.FileName = "cmd.exe";
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.CreateNoWindow = noWin;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardError = true;
                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();
            }
            catch (Exception ex)
            {
                LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
                str = ex.Message;
            }
            finally
            {
                if (p != null)
                {
                    p.Close();
                }
            }
            return str;
        }
        /// <summary>
        /// 创建数据发布类
        /// </summary>
        public static SysPublish NewPublish(SysMeta meta, XYZArgs args, string url, string path)