EDN Admin
Well-known member
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma Hi,
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma I would like to redirect the process output the console and write it into the file. I am using the following code. But it doesn’t work. Please let me know what I missed here.
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:blue;font-family:Courier New string<span style="font-size:10pt;color:windowtext;font-family:Courier New test = <span style="font-size:10pt;color:blue;font-family:Courier New string<span style="font-size:10pt;color:windowtext;font-family:Courier New .Format ( ""{0}" /build debug " , file.FullName , d.FullName + "\devenv.log" );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New Process projectProcess = <span style="font-size:10pt;color:blue;font-family:Courier New new<span style="font-size:10pt;color:windowtext;font-family:Courier New Process( );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo = <span style="font-size:10pt;color:blue;font-family:Courier New new<span style="font-size:10pt;color:windowtext;font-family:Courier New ProcessStartInfo( devLoc + "devenv.exe" , test );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New Console.WriteLine ( file.FullName );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo.CreateNoWindow = <span style="font-size:10pt;color:blue;font-family:Courier New true<span style="font-size:10pt;color:windowtext;font-family:Courier New ;
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo.UseShellExecute = <span style="font-size:10pt;color:blue;font-family:Courier New false<span style="font-size:10pt;color:windowtext;font-family:Courier New ;
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo.ErrorDialog = <span style="font-size:10pt;color:blue;font-family:Courier New true<span style="font-size:10pt;color:windowtext;font-family:Courier New ;
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo.RedirectStandardOutput = <span style="font-size:10pt;color:blue;font-family:Courier New true<span style="font-size:10pt;color:windowtext;font-family:Courier New ;
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.Start();
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:blue;font-family:Courier New string<span style="font-size:10pt;color:windowtext;font-family:Courier New r = projectProcess.StandardOutput.ReadLine();
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New Console.WriteLine ( r );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma
View the full article
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma I would like to redirect the process output the console and write it into the file. I am using the following code. But it doesn’t work. Please let me know what I missed here.
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:blue;font-family:Courier New string<span style="font-size:10pt;color:windowtext;font-family:Courier New test = <span style="font-size:10pt;color:blue;font-family:Courier New string<span style="font-size:10pt;color:windowtext;font-family:Courier New .Format ( ""{0}" /build debug " , file.FullName , d.FullName + "\devenv.log" );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New Process projectProcess = <span style="font-size:10pt;color:blue;font-family:Courier New new<span style="font-size:10pt;color:windowtext;font-family:Courier New Process( );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo = <span style="font-size:10pt;color:blue;font-family:Courier New new<span style="font-size:10pt;color:windowtext;font-family:Courier New ProcessStartInfo( devLoc + "devenv.exe" , test );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New Console.WriteLine ( file.FullName );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo.CreateNoWindow = <span style="font-size:10pt;color:blue;font-family:Courier New true<span style="font-size:10pt;color:windowtext;font-family:Courier New ;
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo.UseShellExecute = <span style="font-size:10pt;color:blue;font-family:Courier New false<span style="font-size:10pt;color:windowtext;font-family:Courier New ;
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo.ErrorDialog = <span style="font-size:10pt;color:blue;font-family:Courier New true<span style="font-size:10pt;color:windowtext;font-family:Courier New ;
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.StartInfo.RedirectStandardOutput = <span style="font-size:10pt;color:blue;font-family:Courier New true<span style="font-size:10pt;color:windowtext;font-family:Courier New ;
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New projectProcess.Start();
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:blue;font-family:Courier New string<span style="font-size:10pt;color:windowtext;font-family:Courier New r = projectProcess.StandardOutput.ReadLine();
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:windowtext;font-family:Courier New Console.WriteLine ( r );
<p class=MsoNormal style="margin:0in 0in 0pt <span style="font-size:10pt;color:#333399;font-family:Tahoma
View the full article