7zip: how to convert Linux SFX archives to Windows SFX?

Super User Asked by Polizi8 on November 1, 2020

I need to compress some files in archives that can be opened by everyone using a Windows PC without 7zip installed.
I thought of running

7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on -sfx -pXXXXXX "dest-archive.exe" "source-folder/"

but this seems to create a Linux (host machine OS) SFX binary.
Is it possible to create Windows SFX archives from Linux?
Is it possible to replace Linux stub with Windows one in already made archives, witout extracting and archiving again?

One Answer

It doesn't seem to be distributed with the Arch Linux package, but copying the file "C:Program Files7-Zip7z.sfx" to my Linux machine allowed the creation of a Windows SFX archives with

7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on -sfx7z.sfx -pXXXXXX "dest-archive.exe" "source-folder/"


cat 7z.sfx old-linux-archive.exe > new-windows-archive.exe

allowed to prepend the Windows stub to the Linux one, without the need to recompress the archive:

file old-linux-archive.exe
#old-linux-archive.exe: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/, BuildID[sha1]=e0e81cea3791be68cca1d95da39fbb406b506cd4, for GNU/Linux 3.2.0, stripped

file new-windows-archive.exe
#new-windows-archive.exe: PE32 executable (GUI) Intel 80386, for MS Windows

Correct answer by Polizi8 on November 1, 2020

Add your own answers!

Related Questions

How to change the .pst default location in outlook 2013

1  Asked on November 22, 2021 by srinivas-jyotula


Can’t boot from USB on Sony Vaio VPCEB11FM

2  Asked on November 22, 2021 by ppgabe


Streaming RTSP with ffmpeg?

1  Asked on November 22, 2021 by candy


How to reset MySQL password

1  Asked on November 22, 2021 by bill-lancaster


Random key pressing continuously with a beep

1  Asked on November 22, 2021 by sanketr


how to fix unknown directive error in nginx?

1  Asked on November 20, 2021 by suikerchiller


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP