- Use condition
- Error codes
- Stored path of archive files
- Self-extracting archive
- Closing the archive
- Translating the interface for self-extraction ( 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
In french: zipCréeExe
Creates a self-extracting archive in the form of 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 = zipOpen(MyArchive, "D:\Backups\Backup.WDZ")
IF ResOpenArchive = 0 THEN
// Create a self-extracting archive
ResArchiveExe = zipCreateExe(MyArchive, "C:\Directories\Archive.EXE")
<Result> = zipCreateExe(<Archive> , <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>: Character string (with quotes) or zipArchive variable
Name of archive to use.
This name can correspond to:
<Executable path>: Character string (with quotes)
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:
Versions 18 and laterzipAdministrator New in version 18zipAdministratorzipAdministrator |Forces the created executable to be run as administrator. This mode is used to avoid the virtualization of files from Windows Vista.|
|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.|
|zipSelectRestorePath||The self-extracting program will display the "Keep the tree structure" check box in the dialog box.|
|zipCurrentDirectory||All the archive files will be extracted into the current directory.|
|zipDefaultDir||Uses the default directory (<Default extraction directory>).|
|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.|
<Executable icon>: Optional character string (with quotes)
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 (with quotes)
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 (with quotes)
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 (an archive is created by zipCreate).
- 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: The icon is not found or the icon format is invalid.
- 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.
A self-extracting archive from a WINDEV archive can be opened with zipOpen
and handled like any other archive.
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 zipOpen.
- 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
has been used on an archive, this archive is not closed. You must call zipClose
to close the source archive.
Translating the interface for self-extraction (<Translation of self-extracting program> parameter)
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 zipCreateExe.
|/TIT=<Title>||<Title> corresponds to the title of the self-extracting window. |
Versions 24 and later
New in version 24/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…
exemplo criar zip e gerar exe
Esse Video vai estrear as 10:00 do dia 11/06/2021
sNome_pasta is string=fExeDir()+"\copia\"
sArquivos_retorno is string=fListFile(sNome_pasta+"*.*") // Vamos ver quais arquivos estao nesse diretorio
LIST_arquivos.DeleteAll() // Cria o list box, -: é opcional
sNome_arquivo_zip is string="arquivo"
FOR EACH STRING sArquivo_individual OF sArquivos_retorno SEPARATED BY CR
LIST_arquivos.Add(sArquivo_individual) // adiciona no list box para ver os arquivos é opciona
IF CBOX_criar_Executavel=True THEN
NOME_ARQUIVO_eXE is string=fExeDir()+"\"+sNome_arquivo_zip+".exe"