我的要求是在安装之前,先检查SQL本机客户端11的安装情况,然后卸载以前的版本。我已经能够检查以前的安装没有任何问题,但是,我无法卸载同样的。
我使用了How to detect old installation and offer removal?中提到的解决方案
在运行时,我得到以下错误
例外:内部错误:未知常数"A22EED3F-6DB6-4987-8023-6C6B7030E554“。
(常量是本机客户端的GUID )在行的执行过程中
Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated, iResultCode);sUnInstallString是
MsiExec.exe /I{A22EED3F-6DB6-4987-8023-6C6B7030E554}提前谢谢。
发布于 2017-02-14 09:56:35
这不是一个(Inno安装)常量。那是个盖德。删除ExpandConstant调用。
您需要将卸载字符串拆分为程序路径及其参数。
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;https://stackoverflow.com/questions/42222356
复制相似问题