在 Inno Setup 中执行 UninstallString [英] Executing UninstallString in Inno Setup
问题描述
我的要求是在安装和卸载以前的版本之前检查以前安装的 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屋!