How to create an installer using Inno Setup which

2019-06-09 07:17发布

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
1条回答
仙女界的扛把子
2楼-- · 2019-06-09 07:38

A generic way to use an external extraction utility with Inno Setup:

  • 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}"""

If you want to present a progress of the decompression, you will have to parse the UnRAR output. For an example (on Arc), see How to add .arc decompression to Inno Setup?

Or use UnRAR.dll, similarly as unarc.dll is used in Inno Setup - How to add cancel button to decompressing page?


Note that the UnRAR.exe tool is free and can be used for these purposes. An extract from its license.txt:

  1. The UnRAR utility may be freely distributed. It is allowed to distribute UnRAR inside of other software packages.
查看更多
登录 后发表回答