Le programme console ConvertZipToSfx.exe permet de créer, à partir d'une archive.zip, une archive auto extractible.

Sous Powershell la méthode SaveSelfExtractor, de la classe Ionic.Zip.ZipFile, génére bien un exécutable, mais la dll Ionic ne peut être extrait lors de l'exécution de l'archive auto extractible.

Le module PsIonic est donc livré avec ce programme encapsulé par la fonction ConvertTo-Sfx.

Ce programme est basé sur un des fichiers projet C# de Ionic et propose un paramètrage plus fin des options de construction d'une archive auto extractible.
C:\Temp> .\ConvertZipToSfx.exe
usage:
  CreateSelfExtractor [-cmdline]  [-extractdir <xxxx>]  [-comment <xx>]
                      [-exec <xx>]  [-Description <xx>] [-FileVersion <xx>]
                      [-IconFile <xx>] [-Copyright <xx>]
                      [-Name <xx>] [-Version <xx>] [-Compiler <xx>]
                      [-Title <xx>] [-Quiet] [-Remove] <Zipfile>

  Creates a self-extracting archive (SFX) from an existing zip file.

  options:
     -cmdline           - The generated SFX will be a console/command-line exe.
                          The default is that the SFX is a Windows (GUI) app.
     -extractdir <xx>   - The default extract directory the user will see when running the self-extracting archive.
                          You can specify environment variables within this string : %USERPROFILE%\Documents
                          The value of these variables will be expanded at the time the SFX is run.
     -exec <xx>         - The command line to execute after the SFX runs.
     -comment <xx>      - Embed a comment into the self-extracting archive.
                          It is displayed when the SFX is extracted.
     -Description <xx>  - The description to embed into the generated EXE.
     -FileVersion <xx>  - The file version number to embed into the generated EXE.
                          It will show up, for example, during a mouseover in Windows Explorer.
     -IconFile <xx>     - The name of an .ico file in the filesystem to use for the application
                          icon for the generated SFX.
     -Name <xx>         - The product name to embed into the generated EXE.
     -Version <xx>      - The product version to embed into the generated EXE.
                          It will show up, for example, during a mouseover in Windows Explorer.
     -Copyright <xx>    - The copyright notice, if any, to embed into the generated EXE.
     -Compiler <xx>     - Additional options for the csc.exe compiler, when producing the SFX EXE.
     -Title <xx>        - The title to display in the Window of a GUI SFX, while it extracts.
     -Quiet             - The Console application SFX will be quiet during extraction.
     -Remove            - Remove the files that have been unpacked, after executing the content of exec parameter.

ErrorLevel 1 : A parameter is duplicated
ErrorLevel 2 : No zipfile specified.
ErrorLevel 3 : That zip file does not exist.

Last edited Mar 15, 2014 at 7:16 AM by LaurentDardenne, version 7

Comments

No comments yet.