簡體   English   中英

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

[英]Uninstall program using System.Diagnostic.Process and its UninstallString in C#

我正在使用此代碼 (也嘗試過此操作)要使用我的注冊表中的“卸載”字符串來卸載程序,但是第一個鏈接的代碼中存在一些錯誤。 林試圖解決它,但我很難弄清楚文件名中的內容和參數中的內容。 我的UninstalString是:

rundll32.exe dfshim.dll,ShArpMaintain ItemMan.Client.application,Culture = neutral,PublicKeyToken = 4f1069eb693dc232,processorArchitecture = msil

注冊表中的目錄是

CurrentUser \\ SOFTWARE \\ Microsoft \\ Windows \\ CurrentVersion \\ Uninstall \\ 9e648bbdf5bc3053

我遇到的問題:

            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();

有了這一點,什么都沒有發生。 我嘗試過的所有其他方式引發錯誤。 您將如何切割/使用uninstalString卸載該程序

卸載字符串是全部內容,第一個可執行文件之后的所有內容都是自變量,因此您需要執行以下操作:

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM