How do you call program B, from within program A using c#
Hello,
I have two programs: A & B. Now I need to call A from within B and at the same time pass some parameters. I tried using Process.Start but it's not working. For example, let say I am calling prog A, that needs an input string from program B. So program B is calling A, passing the string that A needs in order to execute. I hope this is not too confusing!
Thanks!
Jorge L FernandezPosted Nov 5, 2009, 3:07 PM
Please try this:
public void ExecuteExternalProgram(string executablePath, string args)
{
Process myProcessA = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(executablePath);
startInfo.Arguments = args;
startInfo.CreateNoWindow = false;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
myProcessA.StartInfo = startInfo;
myProcessA.Start();
myProcessA.WaitForExit();
}
This will execute the process you want with the specified line of arguments. Good Luck.
If this solve your problem please mark this questions as answered.