Is it possible to start another EXE in Managed Code? At this time, all I can do is use:
System.Diagnostics.Process.Start(exeName)
Is there another way to call another EXE within the same project?
Thanks! JFV
Is it possible to start another EXE in Managed Code? At this time, all I can do is use:
System.Diagnostics.Process.Start(exeName)
Is there another way to call another EXE within the same project?
Thanks! JFV
You could use Assembly.ExecuteAssembly if it is managed. This will execute the main entry point in your current process instead of spinning up a new process.
Process process = new Process();
process.StartInfo.FileName = "c:\test.exe";
process.StartInfo.Arguments = "/e /s";
process.Start();
This way you get a lot of options for your process such as process.WaitForExit() so you may not run asynchronously your process, etc.
Relative paths use the CurrentDirectory, a user can easily change this when launching your app and it can change during execution. I'd recommend using something you can be certain about:
There's a lot of different ways to get your executable's path:
AppDomain.CurrentDomain.BaseDirectory
Assembly.GetExecutingAssembly().Location