有很多程序所以如果我知道它的guid值我怎样才能从c#中使用msiexec.exe卸载
public void msi(string path)
{
//get msiexec.exe /X{GUID} from path
int slash = path.IndexOf(@"/");
//get the substring as /I{GUID}
String value = path.Substring(slash, (path.Length) - slash);
MessageBox.Show(value);
Process process = new Process();
process.StartInfo.FileName = @"msiexec.exe";
process.StartInfo.Arguments = string.Format(value);//Error is in this line
//`i just want to know how to pass the agrument to msiexec from c#`
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = false;
process.Start();
process.WaitForExit();
}
答案 0 :(得分:0)
感谢大家对此代码的支持
Process p = new Process();
p.StartInfo.FileName = "msiexec.exe";
//The argument that you want to give
p.StartInfo.Arguments = "/X{0784DF00-13E1-40D1-8BC4-E081AD2DA509}";
p.Start();