如何使用Inno Setup创建可提取.rar存档内容的安装程序? [英] How to create an installer using Inno Setup which extracts the contents of a .rar archive?
问题描述
我想在Inno Setup中创建一个安装程序,以提取预先创建的Data.rar
存档的内容.我的意思是应该将rar存档的内容视为应用程序的文件和文件夹.
I want to create an installer in Inno Setup which extracts the content of pre created Data.rar
archive. I mean it should treat the contents of the rar archive as files and folders of application.
推荐答案
在Inno Setup中使用外部提取实用程序的通用方法:
A generic way to use an external extraction utility with Inno Setup:
- 创建档案文件
- 将存档嵌入安装程序
- 嵌入了可以将归档文件提取到安装程序的工具
- 使安装程序将存档和工具提取到目标计算机上的临时位置-
{tmp}
- 让安装程序运行该工具以提取档案文件
- create the archive
- embed the archive to the installer
- embed a tool that can extract the archive to the installer
- make the installer extract the archive and the tool to a temporary location on target machine -
{tmp}
- make the installer run the tool to extract the archive
[Files]
Source: "UnRAR.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "Data.rar"; DestDir: "{tmp}"; Flags: deleteafterinstall nocompression
[Run]
Filename: "{tmp}\UnRAR.exe"; Parameters: "x ""{tmp}\Data.rar"" ""{app}"""
如果要显示减压进度,则必须解析UnRAR输出.有关示例(在Arc上),请参见如何将.arc解压缩添加到Inno Setup中?
还是使用UnRAR.dll
,就像 Inno Setup-如何在取消压缩页面中添加取消按钮一样,使用unarc.dll
?
Or use UnRAR.dll
, similarly as unarc.dll
is used in Inno Setup - How to add cancel button to decompressing page?
请注意,UnRAR.exe
工具是免费的,可以用于这些目的. license.txt
的摘录:
Note that the UnRAR.exe
tool is free and can be used for these purposes. An extract from its license.txt
:
- UnRAR实用程序可以免费分发.允许的 在其他软件包中分发UnRAR.
- The UnRAR utility may be freely distributed. It is allowed to distribute UnRAR inside of other software packages.
这篇关于如何使用Inno Setup创建可提取.rar存档内容的安装程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!