1

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?

1
2

It doesn't seem to be distributed with the Arch Linux package, but copying the file "C:\Program Files\7-Zip\7z.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/"

Running

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/ld-linux-x86-64.so.2, 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.