I have created step-by-step instructions on how to do this as I was also confused about how to get this working.
如何使用7zip-sfx开关制作自解压缩文件并运行setup.exe
Here are the steps.
Step 1 - 设置安装文件夹
为了使这个过程更容易,创建一个名为c:\Install的文件夹。这是我们将复制所有所需文件的地方。
Step 2 - 7Zip您的安装程序
1. 进入包含.msi和setup.exe的文件夹
2. 选择.msi和setup.exe
3. 右键单击并选择7Zip -> "添加到压缩文件"
4. 命名您的存档为"Installer.7z"(或您选择的名称)
5. 点击确定
6. 您现在应该有"Installer.7z"。
7. 将此.7z文件复制到c:\Install目录。
步骤三 - 获取7z-Extra sfx扩展模块
您需要下载7zSD.sfx
- 从这里下载LZMA软件包中的一个。
- 解压软件包并在
bin
文件夹中找到7zSD.sfx
。
- 将文件"7zSD.sfx"复制到c:\Install目录下。
步骤四 - 配置您的config.txt文件
我建议使用NotePad++编辑此文本文件,因为您需要使用UTF-8编码,以下说明使用notepad++。
- Using windows explorer go to c:\Install
- right-click and choose "New Text File" and name it config.txt
- right-click and choose "Edit with NotePad++
- Click the "Encoding Menu" and choose "Encode in UTF-8"
Enter something like this:
Title="SOFTWARE v1.0.0.0"
BeginPrompt="Do you want to install SOFTWARE v1.0.0.0?"
RunProgram="setup.exe"
Edit this replacing [SOFTWARE v1.0.0.0] with your product name.
有关安装文件参数和选项的注释
在这里。
检查点
您现在应该有一个名为“c:\ Install”的文件夹,其中包含以下3个文件:
- Installer.7z
- 7zSD.sfx
- config.txt
步骤 5 - 创建归档文件
我在网上找到了这些指令,但是没有任何地方解释上面的四个步骤。
- Open a cmd window, Window + R --> cmd --> press enter
In the command window type the following
cd \
cd Install
copy /b 7zSD.sfx + config.txt + Installer.7z MyInstaller.exe
Look in c:\Install and you will now see you have a MyInstaller.exe
You are finished
运行安装程序
双击MyInstaller.exe,它会提示您的消息。点击“确定”即可运行setup.exe。
附:自动化说明
现在您已经将其安装在c:\Install目录中,我建议创建一个名为“Install.bat”的文件,并将复制脚本放入其中。
copy /b 7zSD.sfx + config.txt + Installer.7z MyInstaller.exe
现在,每当您需要重新构建部署包的新版本时,只需编辑并运行Install.bat即可。