I have a piece of code that runs command line and do some stuff as beneath:
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "CMD.EXE";
System.Console.WriteLine("please insert the path of working directory");
string path = System.Console.ReadLine();
psi.WorkingDirectory = path; //@"D:\Exercises\npp52\scintilla\src";
psi.Arguments = "/C dir /s /b | cccc - --outdir=d:\\jon";
psi.WindowStyle = ProcessWindowStyle.Normal;
Process.Start(psi);
// ... cut ...
XmlTextReader reader = new XmlTextReader(@"D:\jon\anonymous.xml");
while (reader.Read())
{
switch (reader.NodeType) { /* ... */ }
}
The second piece does not wait until first piece is finished and then start. Particularly before first piece will produce anonimous.xml second piece is trying to take that xml.