简体   繁体   English

在C#中使用System.Diagnostic.Process及其UninstallString卸载程序

[英]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.

相关问题 获取密码提示C#System.Diagnostic.Process的通知 - Getting notified of password prompt C# System.Diagnostic.Process 什么是WinRT(C#)上的System.Diagnostic.Process的等价物? - What's the equivalent of the System.Diagnostic.Process on WinRT (C#)? System.Diagnostic.Process中的死锁 - Deadlock in System.Diagnostic.Process 我可以捕获用C#的System.Diagnostic.Process()启动的命令行应用程序的APPCRASH吗? - Can I catch APPCRASH of command line app launched with C#'s System.Diagnostic.Process()? 无法使用System.Diagnostic.Process运行nbtstat - Unable to run nbtstat using System.Diagnostic.Process 如何使用c#通过调用该软件的注册表文件中列出的软件UninstallString来卸载软件但该过程不起作用 - How to uninstall Software using c# by calling Software UninstallString Listed in Registry file of that Software But the Process Is Not Working 如何抑制使用System.Diagnostic.Process执行的exe的对话框? - How do I supress dialogs from an exe that is executed using System.Diagnostic.Process? 如何知道是否已System.Diagnostic.Process由于退出超时? - How to know if a System.Diagnostic.Process has exited due to timeout? 使用C#执行UninstallString - Executing UninstallString using C# 在C#中使用System.diagnostic打开应用程序 - opening application using System.diagnostic in C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM