5
Answers

Call another C# Program & pass parameters to bypass startup form

ic ic

ic ic

15y
8.4k
1

Good day,  I need help.
1. I would like to open up another C# program onclick of button.
2. The other program i wantt to call has the same startup form that the one I'm calling from, how do i bypass the startup form of the program i'm calling with right parameter logins.
3. When trying to call the program from a location i get errors on the path: this seems to work "i:\\app\\test" but if i try this then error: "i:\\app\\test i:\\app\\startup.ini 1" - if i run the location then it's fine "i:\app\test i:\app\startup.ini 1"
Please Assist! Regards
Answers (5)
0
Trinity

Trinity

NA 217 0 15y
You can try this code

string BasePath = Application.StartupPath.ToString();
BasePath = Application.UserAppDataPath;
string ResultingPath = System.IO.Path.Combine(BasePath,"%your application name here%");
System.Diagnostics.Process.Start(ResultingPath);

Accepted
0
Trinity

Trinity

NA 217 0 15y
Ok then mark it as answered
0
ic ic

ic ic

NA 85 0 15y

I got it going :) Thank You All
string root = Application.StartupPath;
string exePath = System.IO.Path.Combine(root, "i:\\app\\test\\WAREH004.exe");
string argPath = System.IO.Path.Combine(root, "i:\\app\\test\\WAREH004.INI");
Process.Start(exePath, argPath + " 1");
0
Trinity

Trinity

NA 217 0 15y

But this path is incorrect

P:\\test\\C#\\WAREH004.exe P:\\test\\C#\\WAREH004.INI 1?!!!
0
ic ic

ic ic

NA 85 0 15y

Apologies for the late reply - Thank You for Assisting.
I get the Error: Cannot find the specified path
string BasePath = Application.StartupPath.ToString();
BasePath =
Application.UserAppDataPath;
string ResultingPath = System.IO.Path.Combine(BasePath, "P:\\test\\C#\\WAREH004.exe P:\\test\\C#\\WAREH004.INI 1");
System.Diagnostics.Process.Start(ResultingPath);
I can start - run - location then the program comes up.
Please Assist