1

I install an MSI file as part of my Inno Setup install script. Is there a way to also uninstall it as part of the uninstall process for my program?

4

2 回答 2

3

最简单的方法是了解那个 MSI 包的 GUID 是什么,

http://msdn.microsoft.com/en-us/library/aa370568(v=vs.85).aspx

安装后,它将在'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall(或其WOW64之一)下注册。

知道 GUID 后,可以通过调用将其卸载

MsiExec.exe /X{A879B90E-B62C-4DA4-9C3F-79A1A6CFAAF9}

这里 {A879B90E-B62C-4DA4-9C3F-79A1A6CFAAF9} 是“Microsoft ASP.NET 网页 - Visual Studio 2010 工具”的示例。

于 2013-11-06T09:05:09.470 回答
0

有很多变体可以做到这一点。有批次:

@echo off
  setlocal
    set "key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
    set raw=%key%\%%i
    for /f "tokens=7 delims=\" %%i in ('reg query %key%') do (
      if "%%i"=="Microsoft .NET Framework 3.5 SP1" (
        for /f "skip=4 tokens=2,*" %%j in ('reg query "%raw%" /v UninstallString') do (
          rem This command iniatlize uninstallation of .NET Framework
          start /wait "%%k"
        )
      )
    )
  endlocal
exit /b

使用 wmic:

wmic Product where Name="Microsoft .NET Framework 3.5 SP1" call Uninstall

和更多。

PS> “Microsoft .NET Framework 3.5 SP1”只是一个例子。

于 2013-11-06T07:45:40.573 回答