How can I create an auto-executing, WinRar SFX file from a batch file?
Asked Answered
O

1

12

I have a 3rd-party installer program that I would like for my users to be able to download and run as a pre-requisite to an application that I have written. The installer can take parameters that allows for a passive installation, where the user can watch the progress of the process but doesn't have to interact with the installation.

Previously, I've accomplished this behavior by creating an SFX file in WinRar. From within the options of the WinRAR GUI, you can specify a file to launch after the archive has been decompressed, as well as parameters to the application.

Is there a way to create an SFX file and set these auto-execution properties using the console? I am trying to create a batch file that takes care of all of this.

Below is my batch file content so far:

C:\Progra~1\WinRAR\rar a -m0 installer_archive.rar install_me.exe
C:\Progra~1\WinRAR\rar s installer_archive.rar installer_auto_extractor.exe

After the final step, what should I do hear to update the SFX?

Outgoings answered 3/3, 2011 at 16:34 Comment(0)
S
31

the easy way is like this:

rar a -r -sfx -z"f:\xfs.conf" auto_install install_me.exe

It will automatically create auto_install.exe in windows.And you need to create a xfs.conf file for sfx configuration; My example is:

; The path to the setup executable
Setup=install_me.exe
; Extract the files to a temporary directory
TempMode
; Use semi-silent mode
Silent=1
; Overwrite any existing files
Overwrite=1
; The title of the SFX archive
Title=Running
; The text to show initially when the user clicks on the SFX archive (will only matter if using Silent=0)
Text
{
The book is preparing to start.
}

Tell me if you still have problem.

Spherulite answered 3/5, 2011 at 7:50 Comment(3)
I am trying to do this same thing. Any chance you can provide a reference for what can go in this configuration file (particularly looking for default extraction directory, and pre and post extraction commands).Eurydice
@Eurydice I think this page off the Acritum site should help you out with the available commands.Etymon
You might consider using -cfg- switch in order to avoid WinRAR's default settings dependency. Otherwise, WinRAR default settings might override your -z"f:\xfs.conf" file content. Cheers!Yahweh

© 2022 - 2024 — McMap. All rights reserved.