AnswerBun.com

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/"

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

Correct answer by Polizi8 on November 1, 2020

Add your own answers!

Related Questions

Expanding inner Veracrypt volume (FAT)

1  Asked on December 27, 2021

   

Failed to create Menus

2  Asked on December 27, 2021 by user1071368

     

spaceport.sys is corrupt – windows 10

1  Asked on December 27, 2021 by developerharon

 

Duplicate UDP packets using iptable

0  Asked on December 27, 2021 by kapil-gupta

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP