[英]Uninstall program using System.Diagnostic.Process and its UninstallString in C#
Im Using this Code (Tried this too) To uninstall a program using my Uninstall string in my registry, but there's some errors in the code of the first link. 我正在使用此代码 (也尝试过此操作)要使用我的注册表中的“卸载”字符串来卸载程序,但是第一个链接的代码中存在一些错误。 Im Trying to fix it but I'm having trouble figuring out what would be in file name, and what would be in Arguments.
林试图解决它,但我很难弄清楚文件名中的内容和参数中的内容。 My UninstalString is:
我的UninstalString是:
rundll32.exe dfshim.dll,ShArpMaintain ItemMan.Client.application, Culture=neutral, PublicKeyToken=4f1069eb693dc232, processorArchitecture=msil
rundll32.exe dfshim.dll,ShArpMaintain ItemMan.Client.application,Culture = neutral,PublicKeyToken = 4f1069eb693dc232,processorArchitecture = msil
The directory in the registry is 注册表中的目录是
CurrentUser\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\9e648bbdf5bc3053
CurrentUser \\ SOFTWARE \\ Microsoft \\ Windows \\ CurrentVersion \\ Uninstall \\ 9e648bbdf5bc3053
The part I'm having trouble with: 我遇到的问题:
System.Diagnostics.Process FProcess = new System.Diagnostics.Process();
FProcess.StartInfo.FileName = "rundll32.exe"; (Dont know if this is right though, but have tried various ways to write the FileName...)
FProcess.StartInfo.Arguments = "9e648bbdf5bc3053";
FProcess.StartInfo.UseShellExecute = false;
FProcess.Start();
FProcess.WaitForExit();
With this bit, nothing happens. 有了这一点,什么都没有发生。 All the other ways I tried Throws an error.
我尝试过的所有其他方式引发错误。 HOw will you Cut up/Use your uninstalString to uninstall that program
您将如何切割/使用uninstalString卸载该程序
The uninstall string is the whole thing, everything after the first executable are arguments, so you need to do something like: 卸载字符串是全部内容,第一个可执行文件之后的所有内容都是自变量,因此您需要执行以下操作:
var start_info = new StartInfo() {
FileName = "rundll32.exe",
Arguments = "dfshim.dll,ShArpMaintain ItemMan.Client.application, Culture=neutral, PublicKeyToken=4f1069eb693dc232, processorArchitecture=msil",
UseShellExecute = false
};
Process process = new Process(start_info);
process.Start();
process.WaitForExit();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.