Inspired by a comment from one of our readers (Frogman) about a tool from the “good old” DOS days. He told us that he used to convert his batch-files into EXE-files using DOS commands. The good news is that this tool still exists inside your windows. Since then it has been updated with a Windows GUI (windows graphical user interface)
Doing a search on the net, you can find literally hundreds of freeware apps to do this conversion, but in this article I will only use the forgotten Windows Tool which is hidden in the System32 folder:
iEXPRESS 2.0
iExpress is actually a program for creating installation packages. But as it creates standalone Executable files (EXE-files) we can use it to execute almost any runtime script we want.
You might be wondering why you would want to convert a Batch-file into an EXE-file. The two files end up doing exactly the same thing. Well, for one thing, you can’t PIN a Batch-file to the Quick-launch, toolbar or Start-menu. Using the iExpress you can also create installation packages containing several batch-files executing each other.
There are a few limitations (of course), for instance; iExpress will not accept the COPY command, only XCopy. Sadly it doesn’t recognise vbs-files as executable scripts without running them from a batch-file.
Create your EXE-file
- Press the Start-button and type
iexpress
Right Click iExpress and choose: Run as Administrator. - In the dialogue window, choose: “Create new Self Extraction Directive file“, click Next.
(Later on if you decide to change an existing project you of course choose OPEN) - The next screen will give a few options. For this project choose: “Extract Files and run an installation command“.
- You can skip through the next two screens as we are not prompting or displaying any license information. Then when asked give your project a name, do so (and choose wisely). Then Continue by clicking Next.
- At this point we are to add the batch-file(s), and any other files deemed necessary.
After you have added all files, click Next. - We need to tell which file(s) are the main one and which to run when running the EXE-file. In this case there is only one, so choose your batch-file in both pull-down menus.
- After you have chosen your primary file, click Next. If we were to install several files we could display the installation dialogue window. But for this project simply choose “Hidden“. Then continue.
- As running a Batch-file doesn’t demand any feedback to the user, choose “No Message” before continuing
- Then there’s an important step:
Choose a filename and place for the EXE-file. Mine is calledSpeaking.exe
.
You can type the location and filename directly into the text-field, or browse to enter the folder name, then typing in the desired filename (C:\My Location\Speaking.exe
).
Also, check the “Hide Animation Option“, before clicking Next. - There should be no reason to reboot your computer after running the batch-file so choose: “No restart“. Click Next.
- Last step: If you would like to save these settings for later use, you may do so by checking the “Save Self Extraction Directive (SED) file“. Click Next and Next again to create your EXE-file.
- Now a CMD-window will open briefly. When it’s done, your file has been created. Check the log for any errors or details. If no errors were displayed – your EXE-file should be ready to launch.
Good Luck!
About Thomas
Computer geek from the age of 7, which amounts to 30 years of computer experience. From the early days (when every computer company had their own OS) of DOS, Windows 1.0 through Seven...
Nice trick n BTW can u pleas tell me how can i bind two file in one(for running both from one file)
-Thanks
There are two commands you can use to trigger a file from a batch-file, but iExpress only supports one of them: Start and Call. If you plan to use iExpress use CALL.
Syntax:
Start Filename.bat
Call Filename.bat
Houw about bat2exe. It comex as a zip file and does not require installation, just run it.
http://download.cnet.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html
There are numerous tools you can download on the net.
The idea was to use a hidden tool that come shipped with Windows.
I will make a post on other tools like bat2exe on a later date.
Thank you for your input.
This one is much, much better, thanks a lot
how about starting an EXE that takes parameters from inside a .bat file. When I convert a .bat that simply starts another exe file with IExpress It always says “Bad Command” even thought the .bat file runs fine.
iExpress doesn’t support all commands that you can run from a BATCH-file.
If the Batch-File runs fine You probably should look at another conversion program or stick with the Batch-file as is.