0

Sorry for my english.

I need from one application to run the console application, and read all that it outputs.

program 'App.exe':

static void Main(string[] args)
{
    foreach (string arg in args)
        Console.WriteLine(arg);

    Console.ReadKey(); // problem here
}

program that reads

static void Main(string[] args)
{
    Process process = new Process
    {
        StartInfo = new ProcessStartInfo
        {
            FileName = "App.exe",
            Arguments = "1 2 3 4 5",
            CreateNoWindow = true,
            UseShellExecute = false,
            RedirectStandardOutput = true
        }
    };

    process.Start();

    Console.WriteLine(process.StandardOutput.ReadToEnd());

    Console.ReadKey();
}

When you run crashes window. Is it possible to solve the problem without changing the application code 'App.exe'?

0 Answers0