user1157206
user1157206

Reputation:

Making folder containing executable into executable

I have a folder which contains an executable file (Exec.exe) and a lot of files that Exec.exe needs to run. Currently, it's pretty ugly having all of those files there when I only need to run the one executable. Is there any way to bundle them all into another executable that runs Exec.exe and also contains all of the files Exec.exe needs to run? Thanks for any help!

Upvotes: 4

Views: 6399

Answers (3)

xosg
xosg

Reputation: 194

use Mac OSX, a folder named *.app can be an executable, double click it and running.

Upvotes: -3

Aby
Aby

Reputation: 1924

Why don't you create a shortcut of "Exec.exe" and keep it somewhere handy ? If whats that you want ?

Or if you want to distribute your app, you can use Winrar/Winzip (winrar is the best) to create a compressed .exe of your entire folder, making "Exec.exe" as your startup app. Use the SFX option in winrar.

Upvotes: 1

parrowdice
parrowdice

Reputation: 1952

Yes, but I would recommend you only do it if you need to.

You can achieve this by adding your files as resources in your exe project, so they are added into the exe's binary at compile time. You can then access the files directly from your exe at runtime by using LoadResource and related functions. I'd recommend reading up on the Portable Executable (PE) file format if you're considering this route.

This is the way to do it if you, and again I stress, need to have only a single binary where you can still access your files. There are obvious downsides to doing this, such as it's much more coding to access the data as it's embedded in your application binary, and you can't easily update the files (check out resource hacker tool) without re-compiling your binary to include the new data.

If the only reason you want to do this is because it's "pretty ugly" seeing the additional files in the same directory as your exe, consider moving them into another directory, for example,

from:

MyExeDir
--myExe.exe
--myFile1.txt
--myFile2.dll
--myFile3.dat

to:

MyExeDir
--myExe.exe
--dat
----myFile1.txt
----myFile2.png
----myFile3.dat

or:

MyExeDir
--bin
----myExe.exe
--dat
----myFile1.txt
----myFile2.png
----myFile3.dat

So all the "ugly" looking files are out of the way.

Upvotes: 4

Related Questions