本文介绍了如何以编程方式卸载当前用户安装的软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我尝试了各种代码,通过编程方式卸载当前用户安装的软件,但每次都失败了。请尽快帮助解决这个问题... I tried various codes for uninstalling software installed on current user by programmatically but failed each time. Please help to solve this ASAP...推荐答案 private void Form1_Load(object sender, EventArgs e) { this.Visible=false; this.Refresh(); string AppName = "Acts Analysis"; RegistryKey myRegKey = Registry.CurrentUser; myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"); String[] subkeyNames = myRegKey.GetSubKeyNames(); if (subkeyNames.Length > 0) { foreach (String s in subkeyNames) { RegistryKey UninstallKey = Registry.CurrentUser; UninstallKey = UninstallKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + s); Object oValue = UninstallKey.GetValue("DisplayName"); if (oValue != null) { if (oValue.ToString() == AppName) { Process[] rundll32Processes = Process.GetProcessesByName("rundll32"); rundll32ProcessesCount = rundll32Processes.Length; oValue = UninstallKey.GetValue("UninstallString"); oValue = oValue.ToString().Replace("rundll32.exe ", "").ToString(); Process p = new Process(); p.StartInfo.FileName = "rundll32.exe"; p.StartInfo.Arguments = oValue.ToString(); p.Start(); checkUI = false; tmrFirstInput.Start(); break; } } } } else { this.Close(); } } 这篇关于如何以编程方式卸载当前用户安装的软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-26 16:00