Sign in to follow this  

[.net] How to run an EXE from a C# project

This topic is 3844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I have built an EXE assembly and now I have created a new project from where I want to run it. Is there any way I can run the already built EXE by adding it as a reference in my current project which will in turn find its entry point and execute it as a separate process? I've already made it work using this code:
System.Diagnostics.Process process2 = new System.Diagnostics.Process();
process2 = System.Diagnostics.Process.Start(@"C:\...");

but I don't really like it as it's using an absolute path to the exe, that's why I want to add the EXE as a reference. Thank you very much

Share this post


Link to post
Share on other sites
Quote:
Original post by Cozmoz
but I don't really like it as it's using an absolute path to the exe

Application.StartupPath + "exename.exe"?


However, out of curiosity, why did you structure it like that? (two exes, one calling the other.)

Share this post


Link to post
Share on other sites
Hey, that did it :), well the reason behind the two EXEs is that I developed them separately and they can work as stand-alone applications, now I decided I could combine them into a bigger application but I don't feel up to reworking the EXE that gets called.


thanks for the quick reply

Share this post


Link to post
Share on other sites

This topic is 3844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this