C# .NET - argument with the process - Asked By mostafa hamdy on 10-Oct-10 07:56 AM

Hello all
I have a simple C# application which have a process and pass some .msi file to it to run , but I want to pass some arguments with the that file like MSIEXC/X to uninstall this msi from my machine , but when do that I get the error message of the MSI installer that this command doesnt exit  what I did is as the following:

ProcessStartInfo PSI = PSI = new ProcessStartInfo(ExePath);

string arg="MSIExec /X";
PSI.UseShellExecute = true ;

PSI.Arguments = arg;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(PSI);

p.WaitForExit();

please if any body get what I mean and can help me please send me or tell me about some url may help me in doing that
Regards
Mosatafa

Peter Bromberg replied to mostafa hamdy on 10-Oct-10 08:57 AM
The way your code is written now you are going to get something link "ExeName" /MSIEXC /X

You want MSIEXEC /x EXENAME

Note the correct spelling of MSIEXEC

Vasanthakumar D replied to mostafa hamdy on 10-Oct-10 09:10 AM
Hi,

You are missing double quotes in arguments,

string arg="\"MSIExec /X\"";

try this...


Regards,
Vasanth
Daivagna Nanavati replied to mostafa hamdy on 10-Oct-10 09:35 AM
Hi Mastafa

try below solution as it works along with what other users have advised, try following

Process.Start("msiexec", @"/x {some guid} /qb");


let me know

Thanks