using System ;
using System .Diagnostics;
using System .IO;
 
class Program
{
    static void Main()
    {
        //
        // Setup the process with the ProcessStartInfo class.
        //
        ProcessStartInfo start = new ProcessStartInfo();
        start.FileName = @"D:\xxxxxxxxx\xxxxxxxxxxxxxxxxx.exe"; // Specify exe name.
        start.UseShellExecute = false;
        start.RedirectStandardOutput = true;
 
        //
        // Start the process.
        //
        using (Process process = Process.Start (start))
        {
            process.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived );
 
            process.BeginOutputReadLine ();
 
            process.WaitForExit ();
        }
    }
 
    static void process_OutputDataReceived( object sender , DataReceivedEventArgs e)
    {
        if (null != e)
        {
            Console.WriteLine (e. Data);
        }
    }
}
  

相关文章:

  • 2021-10-27
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-06
  • 2021-04-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2021-09-09
相关资源
相似解决方案