Tampilkan postingan dengan label 7-Zip. Tampilkan semua postingan
Tampilkan postingan dengan label 7-Zip. Tampilkan semua postingan

Create a self-extracting archive exe PART 2

Posted by Unknown Minggu, 27 Januari 2013 0 komentar
Introduction
A self-extracting archive is a zip or similar compressed file that has been turned into an exe (executable). The advantage of this is that the recipient of the file only has to double click the exe and it will do everything automatically. The two actions it would usually perform are:
  1. To run one of the extracted files (to install a program for example)
  2. To extract the files from the compressed archive file (.zip or similar)
Previously in PART 1 I explained how to create an exe file that when run, would extract files and execute a program.

Here I'll explain how to make a self-extracting archive that prompts the user to extract files to a location on their hard disk. The instructions are very similar, there are just a few differences and most importantly the configuration file used is different. 


Download
If you've not done it already, download and install 7-Zip for Windows. You can find it here: http://www.7-zip.org/

Also, look on the Downloads page for '7z Library, SFXs for installers, Plugin for FAR Manager' - click to download the 7zXXX_extra.7z file.


Instructions
The 7zXXX_extra.7z is a compressed archive file, like a zip file but in the native 7-Zip format. Extract 7zSD.sfx from the 7zXXX_extra.7z file.

Make a new folder for your project. By 'project' I mean that if you plan to make a self-extracting archive you normally would already have some files you want to include in the archive. It makes sense to put them in a single folder. Also, you can reuse this folder if you update your files at a later stage. For the purposes of this example we'll call our project folder MyProject, but yours could be called anything.

Copy the 7zSD.sfx into the folder MyProject.

Now we have to make two files. The first is a configuration file. It determines how the self-extracting exe will work. This configuration file can have any name but to make life easy I recommend you call it '7config.txt'.

Open Notepad

Type the following:

;!@Install@!UTF-8!
GUIFlags="8+64+4096"
BeginPrompt=" "
ExtractPathText="Extract to:"
InstallPath="C:\\MyFiles"
FinishMessage="Finished"
;!@InstallEnd@!


Save the file as 7config.txt to the MyProject folder you created before.

To create the self-extracting exe we will need to type a command at the command prompt (CMD). But why do that each time? What we can do is make a command file and just edit/run that file when you want to make your self-extracting exe. You'll see what I mean soon.

Open Notepad

Type the following:

@echo off
copy /b 7zSD.sfx + 7config.txt + Install_MyFiles.7z Install_MyFiles.exe
echo.
pause


Save the file as 7makeEXE.cmd to the MyProject folder you created earlier.

Now inside your MyProject folder you should have the following files:

7zSD.sfx
7config.txt
7makeEXE.cmd


Now all we need are the files you want to include in the installation package itself. These files should be compressed into a single .7z file. Do not make a .zip file, use 7-Zip's native .7z format.

Save the .7z file in the MyProject folder. Name the .7z file as Extract_MyFiles.7z (or whatever you have used in your 7makeEXE.cmd file).


Use
Double click the Extract_MyFiles.exe and you'll see a prompt:


It prompts the user to extract the files to a drive and folder. Look back at the 7config.txt we made earlier, you'll see how you can customise this window. The user also has the freedom to click the yellow browse button and select a destination folder themselves.

Once the user clicks OK the files are extracted and they'll get this prompt:


This is just a message to say it's finished. I recommend this as it's good confirmation for the user that all the files have been extracted. Again this is customisable from the 7config.txt file.


Customisation
In the 7zXXX_extra.7z file you downloaded before, there is a help file 7zSD_EN.chm - this includes an explanation of all the commands used in the 7config.txt file. 


Conclusion
Using this method to create self-extracting archive exe file makes a lot of sense if you create and recreate self-extracting files often. Especially for those deploying files or updating them. Because you only need to recreate your 7z file and double click 7makeEXE.cmd to rebuild the self-extracting exe file. No messing around with lots of Next prompts. Also the 7z format compresses files so small, if you are supplying installation packages over the internet via FTP, this is perfect.


Reference
If you want to learn how to make a self-extracting archive that runs an EXE at the end, perhaps Setup.exe to install a program - see my first article on this subject: Create a self-extracting archive exe PART 1

Baca Selengkapnya ....

Problem: 7-Zip SFX extracted files disappearing?

Posted by Unknown Jumat, 27 Agustus 2010 0 komentar
I had a self-extracting archive made using 7-Zip SFX. I had many files inside the compressed file. There was one exe file, let's called it A.exe, it was the one run on extraction. In addition A.exe ran another file B.exe. The problem was that upon extraction the B.exe wasn't there! Why didn't it execute, why wasn't it there?

The reason was that my first file, A.exe was an AutoIt script. I used the Run() function to execute B.exe. This was a mistake because the 7-Zip SFX deletes the extracted files after A.exe had finished executing. This meant that B.exe wasn't there or associated files weren't there at execution time. This problem only surfaced when extracting to a SSD (Solid State Disk), maybe because the write times are slower to SSD?

The solution was to change the function to RunWait(). This function runs an external program and waits for it to finish executing before continuing. As long as your first exe (A.exe in my example) is still running, the 7-Zip SFX will not delete the temporary files - problem solved! 

Baca Selengkapnya ....

Create a self-extracting archive exe PART 1

Posted by Unknown Sabtu, 10 Juli 2010 0 komentar
Introduction
A self-extracting archive is a zip or similar compressed file that has been turned into an exe (executable). The advantage of this is that the recipient of the file only has to double click the exe and it will do everything automatically. The two actions it would usually perform are:
  1. To run one of the extracted files (to install a program for example)
  2. To extract the files from the compressed archive file (.zip or similar)
If you want to just simply extract files, see PART 2 but in this article we'll explain scenario 1:

Often I need to make self-extracting exe files to send via e-mail. The recipient runs it, the files are extracted and an installation program (an AutoIt script for example) installs the files. A couple of years ago I used WinZip and the WinZip self-extracting archive utility to do this. It worked well but there were two downsides, firstly it was menu driven, I had to click through 'next' screens and select options each time I used it. Secondly, it cost money, not a lot but still...

7-Zip is the answer! It's an alternative to WinZip. You can download 7-Zip from www.7-zip.org, it is an open source program, therefore free to download. But to create a self-extracting exe file using 7-Zip for Windows you have little control. 

After some searching on the web I discovered that with an additional component, a file called 7zS.sfx (sfx stands for self-extracting), I could create self-extracting exe files using 7-Zip. This article explains how to do this! The best thing about the method I explain here is that you can set it up and use it over and over. Instead of going through multiple 'next' options you just run a command file. For anyone working with self-extracting exe files a lot, this is ideal. 


Download
If you've not done it already, download and install 7-Zip for Windows. You can find it here: http://www.7-zip.org/

Also, look on the Downloads page for '7z Library, SFXs for installers, Plugin for FAR Manager' - click to download the 7zXXX_extra.7z file.


Instructions
The 7zXXX_extra.7z is a compressed archive file, like a zip file but in the native 7-Zip format. Extract 7zS.sfx from the 7zXXX_extra.7z file.

Make a new folder, for example SFXfolder.

Copy the 7zS.sfx into the SFXfolder.

Now we have to make two files. The first is a configuration file. It determines how the self-extracting exe will work, what is shown on the screen and the name of the program that will be run automatically after extraction. This configuration file can have any name but to make life easy I recommend you call it '7config.txt'. 

Open Notepad
Type the following:

;!@Install@!UTF-8!
Title="Install Test"
BeginPrompt="Install?"
RunProgram="setup.exe"
;!@InstallEnd@!

Save the file as 7config.txt to the SFXfolder you created before.

To create the self-extracting exe we will need to type a command at the command prompt (CMD). But why do that each time? What we can do is make a command file and just edit/run that file when you want to make your self-extracting exe. You'll see what I mean soon.

Open Notepad
Type the following:

@echo off
copy /b 7zS.sfx + 7config.txt + Install_Test.7z Install_Test.exe
echo.
pause

Save the file as 7makeEXE.cmd to the SFXfolder you created earlier.

Now inside your SFXfolder you should have the following files:
7zS.sfx
7config.txt
7makeEXE.cmd

Now all we need are the files you want to include in the installation package itself. These files, including setup.exe (the file that will be run after extraction) should be compressed into a .7z file. Do not make a .zip file, use 7-Zip's native .7z format. 

Save the .7z file in the SFXfolder. Name the .7z file as Install_Test.7z (or whatever you have used in your 7makeEXE.cmd file).

Double click 7makeEXE.cmd Wait, once it has finished you'll see the Install_Test.exe file in the SFXfolder. It's ready to be used!


Conclusion
Using this method to create self-extracting archive exe file makes a lot of sense if you create and recreate installation packages often. Especially for those deploying files or updating them. Because you only need to recreate your 7z file and double click 7makeEXE.cmd to rebuild the self-extracting exe file. No messing around with lots of Next prompts. Also the 7z format compresses files so small, if you are supplying installation packages over the internet via FTP or by e-mail, this is perfect. I use this every day and I wouldn't go back to WinZip now even if it was free.


Related
To make a self-extracting archive that only extracts files and does not run an EXE file, see:
Create a self-extracting archive exe PART 2

Please also see this article:
http://mgxp.blogspot.com/2010/08/problem-7-zip-sfx-extracted-files.html


Baca Selengkapnya ....

7-Zip

Posted by Unknown Kamis, 17 Juni 2010 0 komentar
Often we need to make large files smaller, using a file compression program such as WinZip or WinRAR is typical. Those programs can compress files with the file format .zip, .rar, etc. However, both these products are shareware and come at a cost if you want the full versions. But there is something better, it's open source and doesn't cost a penny! It is called 7-Zip, it supports the popular .zip and .rar formats, it also has its own .7z format which I've found to be much better than the traditional .zip format. Often compressing using .7z means a very much smaller file than when using traditional .zip.
I've been using 7-Zip for a couple of years now and I am very happy with it. The interface is simple, not as glossy as WinZip's - it may turn you off but spend some time with it, you'll get used to it soon enough. The best thing about 7-Zip is that there are tools for the power user or for those who need to script. For example, there's a command line version included and you can make self-extracting archives that can automatically run exe files after extraction.
7-Zip is another example of a truly excellent open source project. There are lots of add-ons to use it with other software, such as Firefox or FAR Manager, etc. It's an active project, new versions are available often.


Find out more here: www.7-zip.org


My rating: 9/10, highly recommended

Baca Selengkapnya ....
Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of apk zippy.