Creating a selfextracting executable which will copy itself to temp directory on Windows and launch itself

2k views Asked by At

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.

2

There are 2 answers

0
Yan Sklyarenko On

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.

0
mox On

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).