Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I silently install a 7-zip self-extracting archive to a specific directory?

The Ruby Devkit is a 7-zip based self-extracting archive.

I would like to invoke it silently without having to install 7-Zip to extract the files to a folder of my choosing, so that I can script the installation. I imagine it to be something like:

cmd> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe /silent /dir="C:\DevKit" 

But that, of course, doesn't work. What command line flags must I use to silently extract this archive into a folder of my choice?

like image 433
Jay Godse Avatar asked Jul 16 '13 21:07

Jay Godse


People also ask

How do I use 7Zip to extract files from the command line?

To extract an . 7z archive file, use "e" option, which will extract the archive in the present working directory. 4. To see a list of files in an archive, use "l" (list) function, which will displays the type of archive format, method used, files in the archive among other information as shown.


2 Answers

try this:

C:\> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe -o"C:\DevKit" -y 
like image 56
florind Avatar answered Sep 21 '22 17:09

florind


Update 2017: The tool from 7zsfx.info is now dead and gone.


Original, old post from 08-2015:

If you are trying to extract an 7zip SFX (http://7zsfx.info/) archive:

sfx.exe -y -gm2 -InstallPath="C:\\your\\target\\path"

Switches Docu

  • -y hide some prompts
  • -gm2 hides the extraction dialog completely (silent mode)
  • -InstallPath sets the target path (you need double backslashes)

7z SFX Guide

The official way to create a SFX package is to use -sfx[{name}] : Create SFX archive.

And that means the created SFX packages uses two kinds of CLI options:

  1. official CLI options from 7zSFX, and
  2. the passed through options you configured in your config, before creating the package.

    You can think of it as parameter forwarding to the packaged executable. This parameter forwarding depends on the SetEnvironment and RunProgramm configuration!

The full process:

  1. Create archive Package.7z:
    • containing Installer.msi and additional crap.cab file.
  2. Create config file config.txt:

    ;!@Install@!UTF-8! Title="Installation" SetEnvironment="strInstall=hidcon:Installer.msi /qn" RunProgram="%strInstall%" ;!@InstallEnd@! 
  3. Now we generate Test.exe by combining sfx+config+archive into an executable.

    copy /b 7zS.sfx + config.txt + Package.7z SfxInstaller.exe

    Note: 7zS.sfx is from the official 7zip extra package.

  4. Now, when you run SfxInstaller.exe you can pass for instance /lv InstallerLog.txt to create a install log, e.g.

    SfxInstaller.exe /lv InstallerLog.txt

like image 33
Jens A. Koch Avatar answered Sep 21 '22 17:09

Jens A. Koch