在Inno Setup中执行UninstallString [英] Executing UninstallString in Inno Setup

查看:199
本文介绍了在Inno Setup中执行UninstallString的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求是在安装和卸载先前版本之前,请检查SQL native Client 11的先前安装.我已经能够检查以前的安装,没有问题,但是,我无法将其卸载.

My requirement is to check for previous installation of SQL native Client 11, before installation and uninstall the previous version. I have been able to check for the previous installation with no problems, however, I am unable to uninstall the same.

我使用了如何检测旧安装和取消报价?

在运行时,出现以下错误

During run time, I am getting the following error

异常:内部错误:未知常量"A22EED3F-6DB6-4987-8023-6C6B7030E554".

Exception: Internal error: Unknown constant "A22EED3F-6DB6-4987-8023-6C6B7030E554".

(其中常量是本机客户端的GUID)在执行该行期间

(where the constant is the GUID of the native client) during the execution of the line

Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated, iResultCode);

sUnInstallString

MsiExec.exe /I{A22EED3F-6DB6-4987-8023-6C6B7030E554}

谢谢.

推荐答案

这不是(Inno Setup)常量.那是一个GUID.删除ExpandConstant呼叫.

That's not a (Inno Setup) constant. That's a GUID. Remove the ExpandConstant call.

并且您需要将卸载字符串拆分为程序路径及其参数.

And you need to split the uninstall string to a program path and its parameters.

var
  P: Integer;
  UninstallPath: string;
  UninstallParams: string;
begin
  { ... }

  { In case the program path is quoted, because it contains spaces. }
  { (it's not in your case, but it can be, in general) }
  if Copy(sUnInstallString, 1, 1) = '"' then
  begin
    Delete(sUnInstallString, 1, 1);
    P := Pos('"', sUnInstallString);
  end
    else P := 0;

  if P = 0 then
  begin
    P := Pos(' ', sUnInstallString);
  end;
  UninstallPath := Copy(sUnInstallString, 1, P - 1);
  UninstallParams := TrimLeft(Copy(sUnInstallString, P + 1, Length(sUnInstallString) - P));

  Exec(UninstallPath, UninstallParams, '', SW_SHOW, wWaitUntilTerminated, iResultCode);
  { ... }
end;

这篇关于在Inno Setup中执行UninstallString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆