private static void RunCommand(string directory, string filename, string args) { using (Process process = new Process()) { ProcessStartInfo startInfo = new ProcessStartInfo { WindowStyle = ProcessWindowStyle.Hidden, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true, UseShellExecute = false, StandardOutputEncoding = Encoding.GetEncoding(437), WorkingDirectory = directory, FileName = filename, Arguments = args }; process.EnableRaisingEvents = true; process.EnableRaisingEvents = true; process.StartInfo = startInfo; process.Exited += new EventHandler(ProcExited); process.ErrorDataReceived += Proc_DataReceived; process.OutputDataReceived += Proc_DataReceived; process.Start(); process.BeginErrorReadLine(); process.BeginOutputReadLine(); process.WaitForExit(); } } private static void Proc_DataReceived(object sender, DataReceivedEventArgs e) { EasyLogger.Info(e.Data); } private static void ProcExited(object sender, EventArgs e) { EasyLogger.Info("Process Exited..." + Environment.NewLine); }