Opening a program with parameters!

Jul 4, 2012 at 6:20 AM


I run my system with parameters to set the enviroment I want to run it in. This is inbuilt a long time ago and I cannot change the fact that in order to run in test or system enviroments I will have to provide a parameter.

I have tried the folllowing


Works but gives me production.. Which is not an enviroment I want to test this against, usually when i run my other enviroments i create a shortcut and set the parameters there.

So here's my shortcut mode, it starts the applications in the right enviroment!!! But when trying to get windows, the object i created has no reference as it points towards the shortcut and not the .exe.


how do I sent parameters to the exe when starting it?

Jul 4, 2012 at 9:11 AM




use Process and Application.Attach

Process process = new Process();
process.StartInfo.FileName = "pasth to exe";
process.StartInfo.Arguments = "arguments for application";        
Application app = Application.Attach( process );

 you may use many more Options for start to optimize it.


Jul 4, 2012 at 2:48 PM

Great!! it worked like a charm!!! Thank you!

Oct 16, 2012 at 5:58 AM

Awesome..!! It worked great..Thanks for this post.