I have a child.exe which takes command line arguments. I need to start that child.exe from another parent.exe application and need to pass different command line arguments to that child.exe. I tried with the following code.
Process process = new Process();
process.StartInfo.FileName = @"R:\bin\child.exe";
process.StartInfo.Arguments = "CONSUMER";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.CreateNoWindow = true;
process.Start();
process = new Process();
process.StartInfo.FileName = @"R:\bin\child.exe";
process.StartInfo.Arguments = "SUPERVISOR";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.CreateNoWindow = true;
process.Start();
But the problem here is each time when I call process.Start(), a separate exe is created. I need only one instance of child.exe running which would accept different command line arguments. Any help is appreciated.