Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone,

I want to run an application from another application in c#. I use Process to run exe file. Important note is i have to use process.start method with parameters.

I call the exe like

Process.Start("C:\\Users\\ersin\\Desktop\\Projeler\\FileCatalyst\\FileCatalyst\\bin\\Debug\\FileCatalyst.exe", "acw.username,acw.password, acw.FileName, acw.FilePath");

The problem starts at FileCatalyst.exe

I do like below and it gives error that FileCatalyst.exe does not contain a static suitable 'Main' method

C#
namespace FileCatalyst
{
    class Program
    {
        static void Main(string[] args,string username,string password,string file, string path)
        {

            Console.WriteLine(dsadadsadas");
            Console.WriteLine(ewewewewewew");
            Console.ReadKey();
        }
    }
}



The question is how do i take the parameters on FileCatalyst.exe?

Thanks
Posted
Comments
[no name] 24-Sep-14 11:15am    
That is what the args array is for. Get rid of the extra parameters that are not necessary.

1 solution

i have solved the problem

Firstly, i have learned that System.Diagnotistic.Process.Start(string ,string) takes two parameters that are strings. I set the first parameter to exe file and second parametre to combine of all others parametres as

C#
string parameter = acw.username + "," + acw.password + "," + acw.FileName + "," + acw.FilePath;
string path = "C:\\Users\\ersin\\Desktop\\Projeler\\FileCatalyst\\FileCatalyst\\bin\\Debug\\FileCatalyst.exe";

var process = Process.Start(path, parameter);



And at the exe part i split the parameter by comma and get all variables
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900