Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is that possible, to combine two exe files?

I need it to work like this:

  • User is running combined.exe (combination of 2 exe files).
  • When first exe is loaded and user has clicked "Start" there (I got the source code), then second exe file will run.

Is that even possible?

share|improve this question
There are many ways to do this. Which language are you coding in? Also, to clarify, is this the structure: Combined.exe runs first.exe; After first.exe ends, prompt to run second.exe? Or is first.exe the prompt? – iglvzx Feb 1 '12 at 2:13
first.exe is coded in AutoIT, and user will be able to click "Start" there, to run second.exe (and then first.exe will close itself). – Cyclone Feb 1 '12 at 2:31
Let me know if you need more informations. – Cyclone Feb 1 '12 at 2:31
How familiar are you with AutoIt? You should be able to write this whole thing using AutoIt. I use AutoHotkey myself, and such a program would be a few lines of code. – iglvzx Feb 1 '12 at 2:35
Yea, I know, but I would like to hide both first.exe and second.exe and only the combined.exe to be displayed. =/ – Cyclone Feb 1 '12 at 2:43

Add the second EXE file as a resource in the wrapper program. Then when you need to run it, you can extract it to a temporary directory and run it.

(I take it that by I got [sic] the source code, you mean AutoIt code?) I did only a quick check, but I think AutoIt (or at least the compiler) supports adding and extracting resources and it should support using the Windows API. As for protecting the EXE, there’s really little you can do short of strong encryption, but you can lock the file, and close it with the FILE_FLAG_DELETE_ON_CLOSE flag set to automatically delete it.

share|improve this answer
Yea, good points, but I would like to prevent the both files to be extracted or something, because I dont want any user to have permissions to view first and second.exe (even if it would be extracting to the temporary directory). Also too bad I have no idea about coding in C# =/ – Cyclone Feb 1 '12 at 2:47

In the malware world people often use .exe binders to combine two and sometimes encrypt the final result to prevent detection, so you may find that much of the software available to do this will result in your application being flagged as malware.

Example of software intended for malicious purposes: File Joiner

However, if you omit the encryption stub you may find that the is not flagged, just upload to and check the results. I would do this regardless of which solution you choose.

share|improve this answer

You should look at EXE protectors if you don't want users to be poking at your code. It's hard to dynamically start a new process without a stub EXE of some sort, and I wouldn't even try to write EXE segments from AutoIt. (Actually, I've been able to execute pieces of assembly from AutoIt, but on Vista+ Data Execution Prevention usually kills it.)

share|improve this answer

This is slightly different from your example, but this is how to combine .exe's using AutoHotkey: compile the following script with First.exe and Second.exe in the same folder. After compiling, you only need to keep the single wrapper .exe.

FileCreateDir, tmp

FileInstall, First.exe, tmp\First.exe
FileInstall, Second.exe, tmp\Second.exe

RunWait, tmp\First.exe

MsgBox, 4, , Run Second.exe?

IfMsgBox, Yes
    RunWait, tmp\Second.exe

FileRemoveDir, tmp, 1

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.