How to create one .exe from two .exes?

Posted on

QUESTION :

I am working on a project, and I have two separate .exe files I would like to run on a user’s computer depending on what bit version their OS is (ie, 32 bit vs 64 bit). Are there any utilities/scripting tools I can use to put these two .exe files together into one .exe? I would like the final executable to be able to determine bit version, then run one of the two separate executables.

ANSWER :

One technique used by Sysinternals is to use a 32bit executable that contains the 64bit executable as well. When launched it checks if the system is 64bit and if it is unpacks the 64bit executable to a location like C:UsersUserNameAppDataLocalTemp and runs it. Otherwise it continues normally.

For example the Process Explorer executable Procexp.exe will unpack procexp64.exe and run it.

Leave a Reply

Your email address will not be published.