Creating a selfextracting executable which will co

2019-07-31 23:55发布

问题:

I want to distribute a setup in a self extracting executable form. I want to pack versions for 32 bit and 64 windows. So I have a program which first checks the version of Windows OS running and then launches the correct program. SO I have a directory structure like this

DetermineOS.exe
Win32\Win32Setup.exe
Win32\supporting win32 files
Win64\Win64Setup.exe
Win64\Supporting win64 files

I want to pack them in a bundle called something like install.exe. When the user clicks install.exe it will extract this directory structure to the temp location and launch DetermineOS.exe which will then launch the correct setup.exe

Will NSIS be the easiest way to go? Would this be a compicated NSIS script? Thanks.

回答1:

It sounds to me that the only thing you want to get out of it is to extract to the %TEMP% location and run a certain exe file. If that's the case, I'm not sure NSIS is the easiest way to go. Most of the archives support self-extraction and running a command on extraction-complete. For instance, WinRAR and 7z have such modules. And my gut feeling is this option seems to be easier than NSIS.

Different bootstrappers also support this scenario. For instance, Visual Studio bootstrapper or dotNetInstaller. I've recently blogged about this simplest case with dotNetInstaller.

Hope this helps.



回答2:

You could put the different images (executables) in the "root" image and extract and run the appropriate image as needed (many Sysinternals tools do this - e.g. the "root" application embedds the drivers for 32 and 64 bit).