使用Inno Setup从子目录(相对路径)安装外部文件 [英] Install external file from subdirectory (relative path) using Inno Setup

查看:477
本文介绍了使用Inno Setup从子目录(相对路径)安装外部文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安装一个外部文件.

I would like to install an external file.

我的安装程序位于

c:\somedir\setup.exe

外部文件位于

c:\somedir\download\MyApp.exe

我要做的代码是

[Files]
Source:"\download\MyApp.exe"; DestDir: "{app}";Flags: external skipifsourcedoesntexist

由于某些原因,Inno Setup似乎找不到此文件.

For some reason, Inno Setup does not seem to find this file.

有人可以告诉我我在做什么错吗?

Can anybody tell me what I'm doing wrong?

谢谢.

推荐答案

您有两个问题:

  • 相对于c:\somedir\的路径\download\MyApp.exe解析为c:\download\MyApp.exe,因为前导\返回到根文件夹.您需要使用download\MyApp.exe.

  • The path \download\MyApp.exe relative to c:\somedir\ resolves to c:\download\MyApp.exe, as the leading \ goes back to the root folder. You would need to use download\MyApp.exe.

Inno Setup仍然无法解析相对于安装程序的外部文件路径.您必须使用完整路径,请参阅 Source的文档.参数:

The Inno Setup does not resolve external file paths relatively to the installer anyway. You have to use a full path, see the documentation for the Source parameter:

指定标志external时,Source必须是分发介质或用户系统上现有文件(或通配符)的完整路径名(例如,"{src} \ license.ini").

When the flag external is specified, Source must be the full pathname of an existing file (or wildcard) on the distribution media or the user's system (e.g. "{src}\license.ini").

您可以使用 {src}常量获取安装程序文件夹的完整路径.

You can use the {src} constant to get a full path to the installer folder.

[Files]
Source: "{src}\download\MyApp.exe"; DestDir: "{app}"; \
    Flags: external skipifsourcedoesntexist

这篇关于使用Inno Setup从子目录(相对路径)安装外部文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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