Self extracting archive for Linux and windows

Is there a way to create a self extracting archive that works in both linux and windows? And if so how? Everything I have read on google only works in either Linux or Windows but not both.

AFAIK a self extracting archive is an executeable file that, when run, put the files contained in it into the respective target directories.
You can't have an executeable program for *nix running on Windows nor vice versa.

The file format of executable images varies across platforms, with flavors named: COFF, PE, ELF, Mach-O, and others.

COFF is an old Unix format (from MS-DOS and Xenix, an MS Unix in the 1980's) that MS now has morphed into the Portable Executable (PE) format -- a very much changed format. The Extensible Firmware Interface (EFI) defines PE as the standard format in EFI environments.

Mach-O is the format on OS X boxes.

Linux executables are ELF format. Solaris 10 uses ELF as well on both sparc and x86 platforms. PE+ and ELF64 are the formats in 64 bit format. ELF64 is usually just called ELF, which is confusing.

This is what RudiC is talking about. It is the same idea as 'why does a Windows virus not infect a linux system'. Answer: the file format is garbage as far as the OS image activator can tell.

As already said, self-extracting implies an executable program which you can just run on either platform and it will unpack. On x86 this is not impossible but would need thorough testing on the platforms involved.

However, many times I have found that creating a 'tar' file on Sys V followed by 'compress' (creating a .Z), followed by 'ftp' to a Windows platform, can be unpacked by WinZip or WinRAR quite easily. Again, testing on the specific platforms and specific tar and zip versions is necessary.

It's then possible to script the operation both on Sys V and Windows to unpack the data after detecting which platform it is on and calling the correct utility to unpack the data.

Hope that helps.

Thank you I didn't realize that.

Thank you for the detailed explanation.

What program creates .Z files? Is that 7z?

UNIX compress creates .Z files.

I've seen perl/python/etc scripts floating around that will take a list of files and write a single file containing both the compressed and encoded data and the perl/python/etc code necessary to extract it. If using perl/python/etc is an option, you may want to search for them.

Regards,
Alister