using UnityEngine; using System.Collections; using System.Diagnostics; using System; public class TestBatch : MonoBehaviour { // Use this for initialization void Start() { try { Process myProcess = new Process(); myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; myProcess.StartInfo.CreateNoWindow = true; myProcess.StartInfo.UseShellExecute = false; myProcess.StartInfo.FileName = "C:\\Windows\\system32\\cmd.exe"; string path = "C:\\Users\\Brian\\Desktop\\testFile.bat"; myProcess.StartInfo.Arguments = "/c" + path; myProcess.EnableRaisingEvents = true; myProcess.Start(); myProcess.WaitForExit(); int ExitCode = myProcess.ExitCode; //print(ExitCode); } catch (Exception e) { print(e); } } }