在Inno Setup卸载期间卸载MSI

时间:2013-11-06 07:19:05

标签: windows-installer inno-setup

我在Inno Setup安装脚本中安装了MSI文件。有没有办法在我的程序的卸载过程中卸载它?

2 个答案:

答案 0 :(得分:2)

最简单的方法是了解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工具”的示例。

答案 1 :(得分: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

还有更多。

P.S> “Microsoft .NET Framework 3.5 SP1”仅供参考。