Foo.cmd won't output lines in process
===

I've a problem understanding the in's and out's of the ProcessStartInfo class in .NET.
I use this class for executing .exe programs like FFmpeg with no issues whatsoever.

But when I use ProcessStartInfo to start a .cmd program like a simple foo.cmd containing only `@echo Hello world` it doesn't output anything.

        ProcessStartInfo oInfo = new ProcessStartInfo(@"C:\Program Files (x86)\itms\foo.cmd")
        {
            UseShellExecute = false,
            RedirectStandardError = true,
            RedirectStandardOutput = true,
            CreateNoWindow = true
        };

        using (Process p = new Process())
        {
            p.StartInfo = oInfo;
            p.OutputDataReceived += new DataReceivedEventHandler(transporter_OutputDataReceived);

            p.Start();

            p.BeginOutputReadLine();

            p.WaitForExit();
        }
    
    private void transporter_OutputDataReceived(object sender, DataReceivedEventArgs e)
    {
        Response.Write(e.Data + " - line<br/>");
    }

I've seen a bunch of examples, where people use cmd.exe to start the .cmd program and I've tried this, but with no success. The program just keeps loading indefinitely.

        ProcessStartInfo oInfo = new ProcessStartInfo("cmd", "/c start foo.cmd")
        {
            UseShellExecute = false,
            RedirectStandardError = true,
            RedirectStandardOutput = true,
            CreateNoWindow = true,
            WorkingDirectory = @"C:\Program Files (x86)\itms"
        };

The foo.cmd program works and outputs successfully when using a command line tool in Windows and on Mac.

Could someone please demystify this for me.

Thanks