c#运行批处理文件

 /// <summary>
        /// 代码执行
        /// </summary>
        /// <param name="batName"></param>
        public static void RunBat()
        {
            Process proc = null;
            string targetDir = "Assets/../../../../bats/";//this is where mybatch.bat lies
            try
            {
                proc = new Process();
                proc.StartInfo.WorkingDirectory = targetDir;
                proc.StartInfo.FileName = "xxx1.bat";
                proc.StartInfo.CreateNoWindow = false;
                proc.Start();
                proc.WaitForExit();
                proc.StartInfo.FileName = "xxx2.bat";
                proc.StartInfo.CreateNoWindow = false;
                proc.Start();
                proc.WaitForExit();
                proc.StartInfo.FileName = "xxx3.bat";
                proc.Start();
                proc.WaitForExit();
            }
            catch (Exception ex)
            {
                UnityEngine.Debug.LogError($"Exception Occurred :{ex.Message},{ex.StackTrace.ToString()}!");
            }
        }
上一篇:Simplicity studio 添加预处理脚本(Pre-build)


下一篇:关于tomcat启动运行startup.bat闪退问题