如何从批处理文件创建自动执行的WinRar SFX文件?

RLH*_*RLH 9 console batch-file sfx winrar

我有一个第三方安装程序,我希望我的用户能够下载并运行作为我编写的应用程序的先决条件.安装程序可以采用允许被动安装的参数,用户可以在其中查看进程的进度,但不必与安装进行交互.

以前,我通过在WinRar中创建SFX文件来完成此行为.在WinRAR GUI的选项中,您可以指定在解压缩归档后要启动的文件,以及应用程序的参数.

有没有办法创建SFX文件并使用控制台设置这些自动执行属性?我正在尝试创建一个处理所有这些的批处理文件.

以下是我目前的批处理文件内容:

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
Run Code Online (Sandbox Code Playgroud)

在最后一步之后,我应该怎么做才能更新SFX?

Jam*_*mes 26

简单的方法是这样的:

rar a -r -sfx -z"f:\xfs.conf" auto_install install_me.exe
Run Code Online (Sandbox Code Playgroud)

它会在windows中自动创建auto_install.exe.你需要为sfx配置创建一个xfs.conf文件; 我的例子是:

; 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.
}
Run Code Online (Sandbox Code Playgroud)

告诉我你是否还有问题.

  • 我正在尝试做同样的事情.您有可能为此配置文件中的内容提供参考(特别是查找默认提取目录以及提取前和提取后命令). (3认同)
  • @JMorgan我认为[Acritum网站](http://acritum.com/software/manuals/winrar/html/helpguisfxscript.htm)上的这个页面可以帮助你找到可用的命令. (2认同)