How can I automate the building of this Winrar Sfx File

你离开我真会死。 提交于 2019-11-29 07:30:24

Start WinRAR, click in menu Help on Help topics and open tab Contents. You see there the list items:

  • Command line mode
    • Command line syntax
    • Commands
      • "A" - Add to archive
    • Switches
      • ...
  • Self-extracting modules

All information you need to call WinRAR.exe with the right switches to create an SFX can be found in those help articles.

In general there are two possibilities:

  1. You do what you have already done, but before clicking on final OK, you click on button Profiles on tab General and click on list item Save current settings to a new profile. Then you can call WinRAR.exe with switch "-cpMy SFX Profile". Read the help page for this switch.

  2. You specify all options for creating the SFX archives directly on command line.

For the second possibility something like below can be used as template.

"%ProgramFiles%\WinRAR\WinRAR.exe" a -afzip -cfg- -ed -ep1 -k -m5 -r -tl -iicon"Path to icon file\MyApplicationInstall.ico" "-sfx%ProgramFiles%\WinRAR\Zip.sfx" "-zComment file with full path containing SFX options" "Path to Destination Folder\MyApplicationInstall.exe" "Path to files to add to archive\*"

The content for the *.txt comment file for switch -z can be copied from tab Comment of the dialog opened for creating the archive after selecting all the SFX options.

By the way: I would suggest creating RAR self-extracting archives instead of ZIP self-extracting archives as with RAR compression the EXE file with the right switches for best compression using additionally also solid archive options could be much smaller than with ZIP compression.

So you don't need a batch file or any other application to create a WinRAR SFX archive. A simple shortcut file (*.lnk) with the right command line is all you need to create the SFX archive with a double click on this shortcut whenever you want to create a new SFX for your application.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!