Inno Setup:Exec无法读取字符串? [英] Inno Setup: Exec can't read string?

查看:114
本文介绍了Inno Setup:Exec无法读取字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试组装一个简单的Inno Setup安装程序,该安装程序查找先前的版本并在继续之前将其删除.一切正常,直到我得到以下代码:

I'm trying to put together a simple Inno Setup installer which looks for the previous version and removes it before proceeding. Everything is working fine until I get the following code:

  if Exec(UninstallString, '/SILENT', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
  begin
    MsgBox('Previous version found and uninstalled successfully.', mbInformation, MB_OK);
  end
  else
  begin
    MsgBox('Please uninstall the previous version of this mod before continuing.', mbInformation, MB_OK);
    Result := FALSE;
  end;

这是一段非常简单的代码,但是总是失败.我检查了UninstallString的内容,它们是正确的(C:\Windows\unins000.exe),但是 Exec 失败,并显示以下错误:目录名称无效."

It's a very simple bit of code, but it ALWAYS fails. I've checked the contents of UninstallString and they're correct (C:\Windows\unins000.exe) but the Exec fails with the error: "The directory name is invalid."

看来它无法正确读取"UninstallString"的内容,因为如果我手动输入它们(例如Exec('C:\Windows\unins000.exe, ...),它将可以正常工作.

It appears that it can't read the contents of "UninstallString" correctly, because if I enter them manually (e.g. Exec('C:\Windows\unins000.exe, ...) it works fine.

如何让Exec按预期处理字符串"UninstallString"?

How can I make Exec process the string "UninstallString" as intended?

推荐答案

我不知道您是否已经做过MsgBox来确定注册表中UninstallString exact 字符串.但在注册表中,正常字符串为"C:\Windows\unins000.exe".

I don't know if you already did the MsgBox to determine the exact string in the registry for the UninstallString but in the registry the normal string is "C:\Windows\unins000.exe".

请注意该命令周围的额外 ".

Note the extra " around the command.

在命令周围将Exec"一起使用时,您将得到一个ResultCode 267,这是一个invalid directory错误.因此,您需要在Exec之前将它们剥离.

When using Exec with the " around the command you get a ResultCode 267 which is an invalid directory error. So you need to strip them before the Exec.

Exec中手动输入C:\Windows\unins000.exe时,您方便地忘记了它们;)

When you entered the C:\Windows\unins000.exe manually in Exec you conveniently forgot them ;)

这篇关于Inno Setup:Exec无法读取字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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