????C#??ж?????
????C#??ж?????????? ?????????????????????
Process p = new Process();
p.StartInfo.FileName = "msiexec.exe";
p.StartInfo.Arguments = "/x {C56BBAC8-0DD2-4CE4-86E0-F2BDEABDD0CF} /quiet /norestart";
p.Start();
????C#?????????е?ProductCode
?????鷳?????????ε??????л??ProductCode?? ???????Web?????????????????????????????????
?????????:
public static string GetProductCode(string displayName)
{
string productCode = string.Empty;
// ?????32λ??????????????????64λ?????????64λ??
string bit32 = @"SOFTWAREMicrosoftWindowsCurrentVersionUninstall";
// ???????????64λ?????????32λ??
string bit64 = @"SOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall";
RegistryKey localMachine = Registry.LocalMachine;
RegistryKey Uninstall = localMachine.OpenSubKey(bit32?? true);
foreach (string subkey in Uninstall.GetSubKeyNames())
{
RegistryKey productcode = Uninstall.OpenSubKey(subkey);
try
{
string displayname = productcode.GetValue("DisplayName").ToString();
if (displayname == displayName)
{
string uninstallString = productcode.GetValue("UninstallString").ToString();
string[] strs = uninstallString.Split(new char[2] { '{'?? '}' });
productCode = strs[1];
return productCode;
}
}
catch { }
}
return productCode;
}