private bool ExecuteCommand(string command, string parameters) { if (string.IsNullOrEmpty(command)) { return(true); } var psi = new ProcessStartInfo { FileName = command.Contains("\\") ? command : EnvironmentUtility.FindInPath(command, PackageDirectory + ";" + EnvironmentUtility.EnvironmentPath), Arguments = parameters, CreateNoWindow = false, RedirectStandardError = true, RedirectStandardOutput = true, UseShellExecute = false, WorkingDirectory = PackageDirectory }; if (!psi.FileName.Contains("\\")) { Logger.Error("Target execute command does not have a full path. '{0}'", psi.FileName); } try { var proc = Process.Start(psi); var stdOut = Task.Factory.StartNew(() => proc.StandardOutput.ReadToEnd()); var stdErr = Task.Factory.StartNew(() => proc.StandardError.ReadToEnd()); proc.WaitForExit(); if (proc.ExitCode != 0) { Logger.Error("Failed Execute Command StdOut: \r\n{0}", stdOut.Result); Logger.Error("Failed Execute Command StdError: \r\n{0}", stdErr.Result); return(false); } return(true); } catch (Exception e) { Logger.Error(e); } return(false); }