winrar.msi

介绍 (Introduction)

如果要使用Visual Studio创建单个文件安装程序,则可以使用InstallShield LE,也可以将setup.exe和MSI文件重新打包为自解压文件。 本文介绍了如何使用WinRAR生成后者,从而生成外观专业的软件包。

First of all, you may be tempted to just provide the MSI file for the installation.  You should only do this if you expect your end users to ensure all .NET runtime requirements are present on the install target machine.  This might be adequate in some corporate environments, or for your friends, or for a group of developers, but otherwise Setup.exe bootstrapper should be included with your MSI file.

首先,您可能会想只提供用于安装的MSI文件。 仅当希望最终用户确保安装目标计算机上存在所有.NET运行时要求时,才应这样做。 在某些公司环境中,对于您的朋友或一组开发人员来说,这可能就足够了,但是在其他情况下,MSI文件应包含Setup.exe引导程序。

手动创建安装文件 (Creating the install file manually)

首先,我们将看一下以交互方式创建设置所涉及的步骤。

Select the Setup.exe and your MSI file and right click.  Select the “Add to Archive…” context menu choice.  Now you can edit the archive name, and check the “Create SFX” checkbox.

选择Setup.exe和您的MSI文件,然后单击鼠标右键。 选择“添加到存档...”上下文菜单选项。 现在,您可以编辑档案名称,并选中“创建SFX”复选框。

On the General Tab, check “Create in the current folder” and add the option to run Setup.exe after extraction.  This will launch your installer when the user runs the self extractor.

在“常规”选项卡上,选中“在当前文件夹中创建”,然后添加选项以在解压缩后运行Setup.exe。 当用户运行自解压程序时,这将启动您的安装程序。

Click “Ok” on the bottom of the SFX options dialog, and “Ok” again for the “Add” dialog.  If there are no errors, WinRAR should now create your self extract file.

单击SFX选项对话框底部的“确定”,然后再次单击“确定”以显示“添加”对话框。 如果没有错误,WinRAR现在应该创建您的自解压文件。

Well, this is all well and good, but with all these steps, it’s going to be impossible to keep doing this for every new release of your program.  You’ve created an automated build process for your installer—you don’t want to fiddle around with this GUI every time you rebuild.  Fortunately, WinRAR lets us have the exact same functionality through the command line.

好吧,这一切都很好,但是有了所有这些步骤,就不可能在程序的每个新发行版中都继续这样做。 您已经为安装程序创建了一个自动构建过程-您不想每次重建时都在使用该GUI。 幸运的是,WinRAR通过命令行使我们具有完全相同的功能。

从命令行创建安装文件 (Creating the install file from the command line)

First let’s create two text files, script.txt and list.txt.  You can put these anywhere that is convenient.  I put them both in the output directory for my installer build process, so that folder contains:

首先,我们创建两个文本文件script.txtlist.txt 。 您可以将它们放在方便的任何地方。 我将它们都放在安装程序构建过程的输出目录中,因此该文件夹包含:

Setup.exe

安装程序

MSI file

MSI文件

List.txt

List.txt

Script.txt

Script.txt

The VB.NET code I show later will refer to these files.

我稍后显示的VB.NET代码将引用这些文件。

List.txt is a file containing the full filenames of the files to include in the self extractor.  Put one file line or use wildcards.

List.txt是一个文件,包含要包含在自提取程序中的文件的完整文件名。 放置一个文件行或使用通配符。

C:\temp\New folder\setup.exe
C:\temp\New folder\Setup.msi

Script.txt contains value pairs that configure some of the SFX options.

Script.txt包含配置某些SFX选项的值对。

Title=My Application
Silent=1
Overwrite=1
Setup=setup.exe

Note that the icon will be specified in the command line of the call to WinRAR.

请注意,该图标将在WinRAR调用的命令行中指定。

This call will be constructed like this:

该调用的构造如下:

"<path to winrar>WinRAR.exe" a "<sfxfilepath>" @"<listfilepath>" –ep –sfx –z"<scriptpath>" -iicon"<pathtoicon>"

In VB.NET I use code similar to this to automate this step:

在VB.NET中,我使用类似于以下代码的代码来自动执行此步骤:

Private Sub BuildSFX(ByVal OutputPath As String, ByVal OutputFilename As String)Dim ExePath As String = "C:\Program Files\WinRAR\WinRAR.exe"Dim PathString As String = IO.Path.Combine(OutputPath, OutputFilename)Dim ScriptString As String = IO.Path.Combine(OutputPath, "script.txt")Dim ListString As String = IO.Path.Combine(OutputPath, "list.txt")Dim Options As String = String.Format("a  ""{0}"" @""{1}"" -ep -sfx -z""{2}""", PathString, ListString, ScriptString)Options &= " -iicon""C:\Temp\Icons\AppIcon.ico"""Process.Start(ExePath, Options)
End Sub

结论 (Conclusion)

WinRAR使您能够采用现有的安装和部署项目来创建setup.exe和MSI文件,并基于自解压的可执行文件发布单个文件安装程序。 可以从命令行自动创建此类SFX项目。 当然,在GUI和命令行中都可以使用其他选项。 请查看WinRAR帮助以获取有关命令和开关的信息。

I hope you find this useful.  Please take the time to browse my other articles, and please remember to vote if you find this helpful.

希望这个对你有帮助。 请花时间浏览我的其他文章,如果对您有帮助,请记得投票。

翻译自: https://www.experts-exchange.com/articles/10056/How-to-automate-WinRAR-to-make-a-single-file-installer-from-setup-exe-and-MSI-file.html

winrar.msi

winrar.msi_如何使WinRAR自动化以从setup.exe和MSI文件制作单个文件安装程序相关推荐

  1. winrar 制作自解压文件脚本-实现安装程序

    利用winrar 制作自解压文件功能,可以实现程序打包,制作成安装文件.图形操作方式有点复杂,虽然可以存为配置,后直接调用,但是每次都要鼠标操作,比较麻烦.换一个程序打包也要改配置.直接利用命令行的方 ...

  2. 使用 WinRAR 制作自解压文件

    操作步骤 1 .选择要需要压缩的文件或者文件夹,点击右键,在菜单中选择 WinRAR 的「添加到压缩文件」,打开「压缩文件名和参数」对话框. 勾选「创建自解压格式压缩文件」,压缩文件名的扩展名就会自动 ...

  3. windows winrar 指令_Windows上WinRAR.exe命令行参数说明(转载) .

    [语法] RAR    [ - ]      [ ] RAR [ ]   [ ] 一.简单的例子和说明: 压缩文件夹winrar.exe a -ag -k -r -s -ibck c:/bak.rar ...

  4. Winrar制作自解压安装程序

    一.              选中待制作的压缩文件,如果希望解压后不再套一层文件夹则直接选中这些文件,但是为了避免用户解压时忘记设置软件解压目录,如设置为C:/Program Files而不是C:/ ...

  5. asp.net利用winrar 压缩文件 和解压文件

    注意: 在服务器端必须安装 winrar 源码: string filepath = Server.MapPath("freezip"); string strtxtPath = ...

  6. WinRAR 制作安装程序

    这里以Snipaste一款截图软件为示例,官方已经下载并且安装好了此款软件,安装的路径为D:\Snipaste 现在采用WinRAR软件自解压模式制作EXE的安装模式,并且设置安装路径为C盘目录下 开 ...

  7. DHCP、PXE自动化部署操作系统、DNS正向解析、NFC共享目录服务--(程序员心碎的一天,碎了的自行粘上)

    DHCP.PXE自动化部署操作系统.DNS正向解析.NFC共享目录服务--(程序员心碎的一天,碎了的自行粘上 一.实验准备 二.实验要求 三.实验过程 1.配置DHCP (1).修改虚拟网络编辑器 ( ...

  8. Python 自动化指南(繁琐工作自动化)第二版:十六、使用 CSV 文件和 JSON 数据

    原文:https://automatetheboringstuff.com/2e/chapter16/ 在第 15 章,你学习了如何从 PDF 和 Word 文档中提取文本.这些文件是二进制格式的,需 ...

  9. python 遍历文件夹下文件修改并保存_利用python完成自动化的任务之遍历文件夹修改文件之后并保存备份...

    #利用python完成自动化的任务 #遍历文件夹里面的所有的内容--然后打开---利用正则表达式修改文本的内容(re.sub)---然后写入到新的文本内容中 import docx import re ...

  10. 安装Sql Server:以前的某个安装需要重新引导计算机以便使其更改生效。若要继续,请重启计算机,然后再次运行安装程序。

    安装Sql Server,安装失败两次,错误提示:以前的某个安装需要重新引导计算机以便使其更改生效.若要继续,请重启计算机,然后再次运行安装程序.但是,重启过后再次安装仍然失败. 解决方法: 打开注册 ...

最新文章

  1. 福利 | 与院士和业界翘楚共话智能无人系统!
  2. mysql 备份锁表_mysql 不停机 短时间锁表 备份 主备同步 新增备份机器
  3. Microsoft Visual Studio 2005 Beta 2 下载地址
  4. 逻辑回归模型(Logistic Regression, LR)基础
  5. SQL笛卡尔积结合前后行数据的统计案例
  6. 内网用户之间使用MSN Messenger快速传送文件的小窍门
  7. json学习系列(7)JSONBuilder的用法
  8. 科研牛人是如何看文献的?
  9. java日历类add方法_Java日历setMinimalDaysInFirstWeek()方法与示例
  10. python编程常用代码-Python编程常见问题与解答
  11. iOS 性能优化:Instruments 工具的救命三招
  12. Microsoft.XMLHTTP“没有权限”的错误
  13. 南京大学计算机专业复试面试,南大计算机面试问题汇总及部分答案.doc
  14. 深入浅出程序设计竞赛(基础篇)
  15. idea中各种颜色的含义
  16. MES管理系统,有效解决制造业信息化“断层”
  17. python向excel写数据_Python向excel中写入数据的方法 方法简单
  18. FxFactory 7 Mac版(Mac视觉特效插件包)
  19. 面试太卷,我选择背八股。。。
  20. 计算机应用技术高数学几本书,高一下学期数学学必修几 学哪几本书

热门文章

  1. monetDb列式存储架构分析
  2. 自定义View之滚动刻度尺,2018/1/14 05
  3. 网络数据采集技术snmp/netflow/sflow/network telemetry简介
  4. git push报错 [remote rejected] HEAD (no new changes) error
  5. Java里线程的隔离方式_线程隔离浅析
  6. tr命令解析_学习笔记
  7. 百度大脑人脸识别助力企业实现无感考勤
  8. RPL协议的原理与安全机制
  9. 鸿蒙os2021升级日程,消息称华为EMUI 11.1三月上线:更... - @是Ustinian鸭 的微博精选 - 微博国际站...
  10. python多线程抢红包代码_python实现的抢红包程序代码