Process myProcess = new Process();
string result = string.Empty;
string FilePath = @"f:\";
string FilePath = "Notepad.exe";
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = FilePath+ ExeName;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.Start();
myProcess.WaitForExit();
System.IO.StreamReader ischkout = myProcess.StandardOutput;
if(myProcess.HasExited)
{
string output = ischkout.ReadToEnd();
Response.Write(output);
}
Try setting standard output redirection before starting the process.
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.Start();
string result = string.Empty;
string FilePath = @"f:\";
string FilePath = "Notepad.exe";
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = FilePath+ ExeName;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.Start();
myProcess.WaitForExit();
System.IO.StreamReader ischkout = myProcess.StandardOutput;
if(myProcess.HasExited)
{
string output = ischkout.ReadToEnd();
Response.Write(output);
}
Try setting standard output redirection before starting the process.
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.Start();
No comments:
Post a Comment