如何自动构建此Winrar Sfx文件 [英] How can I automate the building of this Winrar Sfx File

查看:410
本文介绍了如何自动构建此Winrar Sfx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows上使用maven(和一点点蚂蚁)构建应用程序之后,我手动创建了Winrar Sfx安装程序,如下所示:

After building my appplication on Windows using maven (and a little bit of ant) I manually create a Winrar Sfx Installer as follows:

  • 选择文件,右键单击并选择添加到存档
  • 使用浏览.."在上面的文件夹中创建档案文件
  • 将存档格式更改为Zip
  • 启用创建存档格式
  • 选择高级"标签
  • 选择SFX选项
  • 选择设置标签
  • 提取后运行字段中输入setup.exe
  • 选择模式"标签
  • 启用解压缩到临时文件夹
  • 选择文本和图标"标签
  • 输入新标题
  • 从我们从
  • 调用winrar的文件夹中选择setup.ico
  • 选择确定
  • 选择确定
  • Select files, right click and select Add to Archive
  • Use Browse.. to create the archive in the folder above
  • Change Archive Format to Zip
  • Enable Create Archive Format
  • Select Advanced tab
  • Select SFX Options
  • Select Setup tab
  • Enter setup.exe into the Run after Extraction field
  • Select Modes tab
  • Enable Unpack to temporary folder
  • Select text and Icon tab
  • Enter new title
  • Select setup.ico from the same folder that we invoked winrar from
  • Select OK
  • Select OK

但是我可以使用Windows批处理文件/Maven或ant自动执行部分/全部操作吗?

But can I automate some/all of this using Windows batch file/ Maven or ant ?

推荐答案

启动 WinRAR ,在帮助主题上的菜单 Help 中单击并打开标签内容.您会在其中看到以下列表项:

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

  • 命令行模式
    • 命令行语法
    • 命令
      • "A"-添加到存档
      • Command line mode
        • Command line syntax
        • Commands
          • "A" - Add to archive
          • ...

          在这些帮助文章中可以找到通过正确的开关调用 WinRAR.exe 所需的所有信息.

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

          通常有两种可能性:

          1. 您已经完成了自己的工作,但是在单击最终的确定之前,您先点击了常规标签上的个人资料按钮然后单击列表项将当前设置保存到新的配置文件.然后,您可以使用开关-cpMy SFX配置文件" 调用 WinRAR.exe .阅读此开关的帮助页面.

          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.

          您可以直接在命令行中指定用于创建SFX存档的所有选项.

          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\*"
          

          选择所有SFX选项后,可以从打开的用于创建档案的对话框的选项卡注释中复制用于开关-z的* .txt注释文件的内容.

          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.

          顺便说一句:我建议创建RAR自解压存档而不是ZIP自解压存档,因为使用RAR压缩时,使用正确的开关进行最佳压缩的EXE文件使用可靠的存档选项可能比使用ZIP压缩的要小得多.压缩.

          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.

          因此,您不需要批处理文件或任何其他应用程序即可创建 WinRAR SFX存档.每当您要为应用程序创建新的SFX时,只需双击此快捷键即可创建带有正确命令行的简单快捷方式文件(* .lnk).

          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.

          这篇关于如何自动构建此Winrar Sfx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆