using System; using System.Diagnostics; using UnityEditor; using UnityEngine; namespace GFGEditor { public class ProcessUtil { public static void ExcuteBat(string targetDir, string fileName, string argument = null) { Process proc = null; try { targetDir = string.Format(@targetDir);//this is where mybatch.bat lies proc = new Process(); proc.StartInfo.WorkingDirectory = targetDir; proc.StartInfo.FileName = fileName; if(!string.IsNullOrEmpty(argument)) { proc.StartInfo.Arguments = string.Format(argument); } proc.StartInfo.CreateNoWindow = false; proc.Start(); proc.WaitForExit(); } catch (Exception ex) { UnityEngine.Debug.LogFormat("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString()); } } } }