- Use condition
- Error codes
- Stored path of archive files
- Self-extracting archive
- Closing the archive
- Translating the interface of the self-extracting program ( parameter)
- The executable is found on a media from which the archive files cannot be extracted
- The self-extracting archive contains executable files
- Command line parameters of a self-extracting archive
<zipArchive variable>.CreateExe (Function)
In french: <Variable zipArchive>.CréeExe
Creates a self-extracting archive as a 32-bit executable (.EXE). When this executable is run, the files found in the archive are automatically decompressed on the current computer.
// Declare the variables
MyArchive is zipArchive
// Open the archive "MyArchive"
ResOpenArchive = MyArchive.Open("D:\Backups\Backup.WDZ")
IF ResOpenArchive = 0 THEN
// Create a self-extracting archive
ResArchiveExe = MyArchive.CreateExe("C:\Directories\Archive.EXE")
<Result> = <Archive>.CreateExe(<Executable path> [, <Extraction options> [, <Executable icon> [, <Default extraction directory> [, <Translation of self-extracting program>]]]])
- 0 if the executable was created,
- An error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
<Archive>: zipArchive variable
Name of a variable of type zipArchive corresponding to the archive to use.
<Executable path>: Character string
Path of executable to create (up to 260 characters). This path can be a path relative to the current directory or a full path.
The .EXE extension is mandatory.
<Extraction options>: Optional constant
Extraction options to use:
|zipAdministrator||Forces the created executable to be run as administrator. This mode is used to avoid the virtualization of files from Windows Vista.|
|zipCurrentDirectory||All the archive files will be extracted into the current directory.|
|zipDefaultDir||Uses the default directory (<Default extraction directory>).|
|zipSelectRestorePath||The self-extracting program will display the "Keep the tree structure" check box in the dialog box.|
|The archive files will be extracted from the temporary directory of the computer where the executable is run. All the files are extracted into the same location.|
|zipTree||The archive files will be extracted according to the tree structure of directories found in the archive.|
|zipWithUI||The self-extracting program will display a dialog box allowing the user to chose the destination directory.|
<Executable icon>: Optional character string
Path of the icon file representing the created executable. This path can correspond to a path relative to the current path or to a full path.
If this parameter is not specified, a default icon will be assigned to the executable.
<Default extraction directory>: Optional character string
Directory proposed by default by the decompression window (if the zipWithGUI constant is proposed). If no extraction interface is proposed, this directory will be used by default to extract the archive files.
<Translation of self-extracting program>: Optional character string
Full path of file (INI format) that contains the translation of messages for the self-extracting program. The format of this file is presented in details in the Notes.
A self-extracting archive can be created only if:
- The archive exists (archives are created using <zipArchive variable>.Create).
- The archive is accessible in read/write.
- The archive is a single-part archive.
- Archives in "CAB" format: This function is not available.
- Archives in "RAR" format: This function is not available.
- Archives in "7z" format: This function is not available.
- Archives in "TAR" and "TARGZ" format: This function is not available.
The following error codes are returned:
- 10: Insufficient space to create the executable or the user has no write rights on the initial archive (.WDZ).
- 11: Error converting archive to self-extracting archive.
- 12: Insufficient space to create the executable or the user has no read rights on the initial archive (.WDZ).
The message corresponding to the error code is returned by zipMsgError
Stored path of archive files
When the files are extracted from a self-extracting archive, the stored path of the files is not kept. Only the name and the extension of the files are stored.
The source archive (.WDZ or .ZIP) cannot be rebuilt from a self-extracting archive.
No password can be defined for a self-extracting archive.
- A self-extracting archive in ZIP format cannot be opened by <zipArchive variable>.Open.
- If the self-extracting archive contains empty and non-empty sub-directories, when decompressing the archive, only the directories that contain a file are re-created.
Closing the archive
Once <zipArchive variable>.CreateExe
has been used on an archive, this archive is not closed. You must call <zipArchive variable>.Close
to close the source archive.
Translating the interface of the self-extracting program (<Translation of self-extracting program> parameter)
By default, the self-extracting program comes in three languages: English, Spanish and French. The self-extracting program will use the language of the executable or the language specified by Nation
The interface of the self-extracting program can use a language other than the default language (English).
To do so, create a .INI file containing the following information:
R000=Self-extracting PC SOFT archive
R001=Extract the content of the archive in the directory:
R002=Keep the tree structure
For example, to get an interface in French:
R000=Archive Autoextractible PC SOFT
R001=Extraire le contenu de l'archive dans le repertoire:
: The first three lines of this file must not be modified.
In the following lines, specify the desired translation.
The "Translation of self-extracting program" parameter must correspond to the path of the .INI file containing the translation of the interface.
The executable is found on a media from which the archive files cannot be extracted
The executable may be found on a media (CD for example) from which the archived files cannot be extracted. In this case, run the executable and specify in the command line:
The <Directory> parameter specifies the location from which the archive files must be extracted. If the <Directory> parameter contains space characters, the character string must be enclosed in quotes.
This parameter has priority over the <Extraction directory> parameter.
The self-extracting archive contains executable files
If the last archived file is an executable (.EXE), this file will be automatically run once all the archive files have been extracted.
Command line parameters of a self-extracting archive
The following parameters are used to launch a self-extracting archive from the command line:
|/DIR=<Directory>||Used to specify where the archived files should be extracted from. If the <Directory> contains space characters, the character string must be enclosed in quotes.|
Caution: This parameter has priority over the parameter <Extraction directory> specified with <zipArchive variable>.CreateExe.
|/TIT=<Title>||<Title> corresponds to the title of the self-extracting window. |
|/PID=<Num PID>||Used to wait for the end of the <PID Num> process before starting the extraction.|
|/SILENT||Used to start the extraction without a progress bar or a dialogue. |
|/WAIT||If the self-extracting archive starts an executable, the first window will remain opened until the end of the executable. |
|/RELANCE||Extraction with administrator rights. |
This page is also available for…