System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = ProgramPath;
p.StartInfo.WorkingDirectory = @"D:\";
p.StartInfo.Arguments = ProgramArguments + FilePath;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
//Log.WriteToLog("Info", "filename=" + p.StartInfo.FileName + ", Arguments=" + p.StartInfo.Arguments);
Log.WriteToLog("Info", "Added program to execute \"{0}\" argument \"{1}\".", p.StartInfo.FileName, p.StartInfo.Arguments);
p.Start();
using (StreamReader myStreamReader = p.StandardOutput)
{
string result = myStreamReader.ReadToEnd();
p.WaitForExit();
p.Close();
Log.WriteToLog("Info", "relation import finished!");
}
沒有留言:
張貼留言