winrarsfx

WinRAR SFX optional message but not in temp mode


If I am creating an SFX archive, I can set an optional question by enabling Temp Mode (files are unpacked to temporary folder), which presents the user with a nice "Are you sure" type question when they run the extractor program.

However, by enabling Temp Mode, it totally ignores the "Extract to path" setting. But if I disable Temp Mode, the question is not available!

How can I get it to extract to my desired path, but to also be able to set that optional question?


Solution

  • The help page opened after pressing button Help on tab Modes of dialog Advanced SFX options contains the paragraph

    If Unpack to temporary folder option is set, you should also specify Setup program. SFX ignores Path to extract parameter in this mode.

    The reason is quite simple and explained above this paragraph in help. By extracting the archive to a temporary folder, the called setup application (*.exe, *.bat, ...) is responsible for copying the files to the installation folder.

    But if you want that WinRAR SFX extracts the archive directly into a predefined folder and you want give the user the possibility to cancel installation before starting extraction:

    1. Don't use Unpack to temporary folder on tab Modes.
    2. Instead set Path to extract on tab General.
    3. Select Display all on tab Modes.
    4. Select either Extract and replace files or Extract and update files on tab Update and Overwrite all files.
    5. Enter a useful text for the user on tab Text and icon in edit field Text to display in SFX window which contains the information as in question so that the user can decide when pressing button Extract or Install and when pressing button Cancel on execution of the SFX archive.

    Another possibility would be to enter on tab License a title and the question text as License text resulting in execution of the SFX archive that first the dialog is displayed with the "license text" being now the question with the buttons Accept and Decline.

    The third possibility you have is creating a copy of the SFX you want to use with a different name and use a tool like free Resource Hacker to customize this SFX to your needs, i.e. change icons, bitmaps, text of buttons and position in dialog, size of the dialogs, etc. This is explicitly permitted as you can read in help of WinRAR on page with title GUI RAR and ZIP SFX modules (Default.SFX and Zip.SFX). You could for example redefine the layout of the license dialog to look similar to a question message box with the buttons Yes and No in your customized SFX. I used this solution for 2 applications which are installed/updated with a WinRAR SFX archive and it is really quite easy to create such a customized SFX using Resource Hacker.