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

﹥>﹥吖頭↗ 提交于 2020-01-30 19:37:12

问题


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?


回答1:


try this:

C:\> DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe -o"C:\DevKit" -y



回答2:


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




回答3:


Since 7-zip is used, simply create a self-extracting archive in .exe. and run it with switches -o and -y.

I use it to save space on USB drive. For instance, I run VDiskAir application infrequently. I create a self-extracting archive of the VDiskAir program folder (about 15MB):

7z a -SFX -mx9 VDiskAir.exe [VDiskAir folder path]

NB: -mx9 is used here to maximise compression.

I create a DOS BAT to run the self-extracting VDiskAir.exe (about 5MB) created, save it as VDiskAir.bat containing:

VDiskAir.exe -o%TMP% -y

%TMP%\VDiskAir\VDisk_Air.exe

I'm not worried that the VDiskAir folder (in %TMP% extracted with VDiskAir program files) is undeleted after running VDiskAir this way, since I have a BAT script to clear %TMP% on shutting down/starting up.




回答4:


Below is what I use for Autodesk product:

Start /W %~dp0AutoCAD_2018_French_LP_Win_64bit_dlm.sfx.exe -suppresslaunch -d C:\Autodesk


来源:https://stackoverflow.com/questions/17687390/how-do-i-silently-install-a-7-zip-self-extracting-archive-to-a-specific-director

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!