How to Convert a (Batch File) BAT to EXE [Step-by-Step]

Nicholas Xuan Nguyen

Read more posts by this author.

Are you wondering how to compile your old batch scripts into a single package? Why not convert your .bat files to .exe? Converting .bat files to a .exe also lets you secure your script code as it won’t be visible to the naked eye.

In this tutorial, you’ll learn how to convert batch files to executables via built-in and third-party tools.

Let’s start converting!

Converting BAT file to EXE via IExpress

IExpress is a tool that comes with your Windows OS installation to create stand-alone executables from any script file. But first, let’s create a short batch script to demonstrate how IExpress works to convert a bat script file.

1. Open your favorite text editor, copy/paste the code below and save the file as HelloWorld.bat.

The code below prints the text Hello world, ATA. The double colons (::) lets you add a comment in a batch script file.

:: Stops the script from printing out commands as they are executed
@ECHO OFF 

:: Prints out a message on the terminal
ECHO Hello world, ATA. 

:: Waits for a user input before continuing with the rest of the script
PAUSE 

2. Next, click on the Start button and search for iexpress. Right click on iexpress.exe and choose Run as administrator as you need admin rights to create a system-level executable.

Searching and Launching IExpress
Searching and Launching IExpress

3. On IExpress’ initial page, choose the Create New Self Extraction Directive (SED) option, and click on Next.

A SED instructs Windows to extract a cabinet file or executable ( .DLL or .EXE file) and write it directly to the disk without user intervention.

Creating a SED File
Creating a SED File

4. Now, choose the Extract files and run an installation command option on the Package Purpose screen. This option lets Windows extract the contents of the EXE file and run the command inside the EXE file when you run the EXE file.

Choosing Package Purpose
Choosing Package Purpose

5. Enter a preferred title for the package and click on the Next button. For this example, the package title is HelloWorld. The package title appears on all prompts the user will see during the installation or execution of the EXE file.

Naming the Package
Naming the Package

6. Keep the defaults and click on Next on both the Confirmation prompt and the License agreement pages. These options will not affect the installation at all.

When you set a confirmation prompt, Windows asks the user whether to continue with the EXE installation or not. While setting up a license agreement prompts the user to accept the agreement or not upon running the EXE file.

Adding Confirmation Prompt
Adding Confirmation Prompt
Setting up a License Agreement
Setting up a License Agreement

7. Now, click on the Add button in the Packaged files page to select the file you wish to convert and click on Next.

Choosing a batch file to convert to executable
Choosing a batch file to convert to executable

8. Enter the command below to the Install Program field. The /c argument tells cmd to run the batch file and then terminate.

cmd /c HelloWord.bat
Adding Custom Command to Extract Files without Installing
Adding Custom Command to Extract Files without Installing

9. Keep the defaults in the following steps until you get to the Package Name and Options page.

10. Now, click on the Browse button to select a target path, name the EXE file anything you prefer, then click Next. For this example, the EXE file is named HelloWorld.exe.

Naming the EXE File
Naming the EXE File

11. Keep the defaults in the next few steps until you reach the Create package page.

12. Click the Next button on the Create package page to create the EXE file.

Creating the EXE file
Creating the EXE file

13. Finally, navigate to the target you selected in step 10 and run the EXE file (HelloWorld.exe) to see if it works.

Below, you can see the EXE file (HelloWorld.exe) opened a terminal session and printed the Hello world, ATA text.

Running the EXE File
Running the EXE File

Converting BAT Scripts to EXE with Bat To Exe Converter

If you’re not into performing tedious steps like IExpress, a popular third-party tool converts .bat to .exe file and is more effective and convenient. Bat To Exe Converter is a free yet handy tool that quickly converts one or several .bat files in a few steps.

1. Open your favorite web browser, download Bat To Exe Converter, and install it.

2. Next, launch the Bat To Exe Converter and click on the Open toolbar button at the window’s top-left corner, and locate the batch file you want to convert (HelloWorld.bat).

Opening Batch File to Convert to EXE File
Opening Batch File to Convert to EXE File

3. Click on Convert to provide a name and target location for the EXE file, then click Save to convert your batch file to an EXE file.

Converting Batch File to EXE
Converting Batch File to EXE

4. Finally, run the EXE file and see if it works.

Converting BAT Scripts to EXE via Advanced BAT to EXE Converter

As the name suggests, the Advanced BAT to EXE Converter is the best all-inclusive BAT converter, and it’s free! This tool converts batch scripts to EXE files and batch scripts to MSI, DLL, and VBS files.

1. Download Advanced BAT to EXE Converter, then install it.

2. Next, launch Advanced BAT to EXE Converter and click on the File menu → Open to select the script file to convert to EXE.

Opening the file menu
Opening the file menu

3. Now, click on the Build EXE button on the top left. In the Select EXE Options window, click on the Build EXE button, as shown below, to build the EXE file based on the settings you selected.

Perhaps you have dependencies you want to embed on the EXE file. If so, click on the Embed Files tab in the Select EXE Options window and add files to embed.

Converting Batch Files to EXE
Converting Batch Files to EXE

Now, set a target path and provide a name for your EXE file. Click Save to start converting your batch file to EXE. Below, you can see the conversion progress at the bottom of the window.

ConvertSelecting Save Location for the EXE Fileing batch file
Selecting Save Location for the EXE File

Below, you can see the conversion progress at the bottom of the window.

Converting batch file
Converting batch file

Finally, run the EXE file and see if it works.

Conclusion

In this guide, you’ve discovered that conversion of the batch script to EXE is possible. You’ve learned how to convert a batch script to an EXE file with built-in and third-party tools.

Now would you choose any of the tools in building your project and convert your scripts into executable? Perhaps try embedding multiple dependencies (script files) to your executable file?

Subscribe to Stay in Touch

Never miss out on your favorite ATA posts and our latest announcements!

Looks like you're offline!