Crear archivos SFX autoextra�bles
Aspose.ZIP permite crear un archivo autoextra�ble (SFX). Se trata de un tipo especial de archivo comprimido, que tiene una extensi�n de nombre de archivo .exe. Puede descomprimir un archivo autoextra�ble haciendo doble clic en �l.
Creaci�n de un archivo autoextra�ble.
Para componer un archivo autoextra�ble instancie SelfExtractorOptions y p�selo a ArchiveSaveOptions al guardar.
1try (FileOutputStream zipFile = new FileOutputStream("archive.exe")) {
2 try (Archive archive = new Archive()) {
3 archive.createEntry("entrada.bin", "datos.bin");
4 ArchiveSaveOptions options = new ArchiveSaveOptions();
5 options.setSelfExtractorOptions(new SelfExtractorOptions());
6 archive.save(zipFile, options);
7 }
8} catch (IOException ex) {
9}Ejecutando archivo autoextra�ble
El archivo que produce es ejecutable y requiere .NET Framework 2.0 o superior para ejecutarse. Dichos marcos se suministran con Windows Vista y superior.
Puede ejecutarlo como un programa normal haciendo doble clic, o ejecutarlo a trav�s de la interfaz de l�nea de comandos.
Si desea iniciar la extracci�n autom�ticamente, especifique la opci�n de l�nea de comandos -autoExtract. Ejemplo:
1C:\>archive.exe -autoExtract -password:T0p$ecretOpciones de l�nea de comandos para archivos autoextra�bles.
| Option | Meaning | Sample |
|---|---|---|
| -autoExtract | Primary option - without it decompression does not start. Extraction starts automatically, other options apply. | sfx.exe -autoExtract |
| -autoClose | Window closes when the extraction is complete. This option only makes sense if -autoExtract option is present. | sfx.exe -autoExtract -autoClose |
| -forceOverwrite | Overwrites all existing files without prompt if there are any. This option only makes sense if -autoExtract option present. | sfx.exe -autoExtract -forceOverwrite |
| -password: | Provides a password to encrypted entries. This option only makes sense if -autoExtract option is present. If you have spaces within the password quote it. | sfx.exe -autoExtract -password:T0p$ecret |
| -destination: | Extracts files to the supplied directory. This option only makes sense if -autoExtract option is present. If you have spaces within the path quote it. | sfx.exe -autoExtract -destination:"C:\My Documents" |
Puede utilizar estas opciones para componer Batch Script en Windows.