// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Diagnostics; namespace E { public class Program { public static void Main(string[] args) { for(int i = 0; i < 3; i++) { ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "cmd"; psi.Arguments = "/c cd"; psi.UseShellExecute = false; Process p = new Process(); p.StartInfo = psi; p.EnableRaisingEvents = true; p.OutputDataReceived += (s, e) => Console.WriteLine(e.Data); p.Start(); p.WaitForExit(); Console.WriteLine("*"); } } } }