Umesh Sehta
Umesh Sehta

Reputation: 10683

Start Process using c#

i have setup which i need to install using my wpf application. I am not able to pass params to setup.exe file.I am able to install that setup using .bat file by this command:-

.\setup.exe /v"MYINSTALLERTYPE=Client"

Then how i can pass params by using c# here is my c# code:

 String path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
        ProcessStartInfo p = new ProcessStartInfo(path + "\\SetupFiles\\setup.exe","MYINSTALLERTYPE=Client");
        Process proc = new Process();
        p.WindowStyle = ProcessWindowStyle.Hidden;
        proc.StartInfo = p;
        p.UseShellExecute = false;
        proc.Start();
        proc.WaitForExit();

Please help me Thanks in advance

Upvotes: 0

Views: 121

Answers (1)

evilkos
evilkos

Reputation: 597

Is it maybe because you missed /v flag? The second line of your listing should look like:

ProcessStartInfo p = new ProcessStartInfo(path + "\\SetupFiles\\setup.exe", "/v\"GURUINSTALERTYPE=Client\"");

You have to escape the needed quotes as shown, using the \ character.

Upvotes: 3

Related Questions