Due to the project needs, a green version of the software (that is, no need to write files in the C drive) to the customer, the requirement is only one EXE file, double-click to execute.
Online said WinRAR software to create self-extracting files can be implemented, link http://blog.csdn.net/harvic880925/article/details/27675073
This method is manual, and is often required to be executed as a command line in a project. I checked the WinRAR's own help, and realized the way.
Principle: Package The files in the software to an EXE file, double-click the EXE, the first is to perform the decompression operation, the extracted files into the temporary folder, and then automatically execute the temporary folder exe file. Because it is placed in the temporary folder, the user feels that there is only one EXE file.
Realize:
1. Open the C:\Program Files (x86) \winrar folder and copy the Default.sfx, WinRAR.exe and Rar.exe into your project directory;
2. Put the required files of your green software into the soft folder;
3. Create the Note.txt comment file, edited as follows, meaning temporary folder, silent mode, overwrite write and auto execute after startup file:?
Tempmode
Silent=1
Overwrite=1?
Setup=soft/soft.exe
4. Create the Run.bat file and edit the following command:??
WinRAR.exe a soft.exe./soft??
Rar.exe c-znote.txt Soft.exe?
At this point, double-click Soft.exe to complete customer requirements. Command line mode can also add self-extracting icon to the generated EXE, command for-iicon, interested can be self-winrar in the Chinese help to find and use.
Disadvantages: Double-click operation is a decompression operation, large software decompression takes time, so for large software, encapsulation into an EXE file may not be meaningful. But usually see the general is also small software made an EXE form.
vs using the WinRAR software to package software in a command-line manner to an EXE