"Peter Duniho" <NpOeStPeAdM@nnowslpianmk.com> wrote in message
news

p.tqb8fs0u8jd0ej@petes-computer.local...
> In any case, you don't have a sample that anyone else can use to try to
> reproduce your problem, so it's not possible for anyone to look directly
> at what's going on.
Lots of people have PowerShell, it's a Windows Update piece.
Just swap out PowerShell for CMD.exe:
using System;
using System.Collections.Generic;
using System.Diagnostics;
public class MyClass
{
public static void Main()
{
try {
ProcessStartInfo psi = new ProcessStartInfo(
@"C:\Windows\system32\cmd.exe");
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
//psi.RedirectStandardError = true;
Process process = new Process();
process.StartInfo = psi;
bool started = process.Start();
if (started)
{
process.StandardOutput.ReadLine(); // "Microsoft Windows"
process.StandardOutput.ReadLine(); // "Copyright Microsoft"
process.StandardOutput.ReadLine(); // [blank line following logo]
process.StandardOutput.ReadLine(); // [command entry (echo)]
process.StandardInput.WriteLine("echo Blah");
process.StandardInput.Flush();
string ret = process.StandardOutput.ReadLine(); // <-- stalls here
System.Console.WriteLine("CMD.exe says " + ret + "\".");
}
} catch (Exception e) {
}
RL();
}
}