Create Batch File (.BAT) to Run EXE Program

In Windows you can run any program with the .exe extention from a batch file that is very useful in different automation scenarios.

For example, you may want to create a batch file to use it as a launcher for the program that you want to execute with some parameters.

In this note i am showing how to create a batch file to run an .exe program.

Cool Tip: How to comment batch files in Windows! Read more →

Create Batch File to Run EXE

To create a batch file to run some .exe program in Windows, open a text editor (e.g. Notepad) and enter a command as follows:

start "C:\Path\Program.exe"

If you need to run a program with some additional parameters, you should also specify a "WindowName" just after the start command:

start "MyProgram" "C:\Path\Program.exe" /param1 /param2

Invalid switch: If you set some parameters without specifying the "WindowName" or at least the empty quotation marks "", you will get the “Invalid switch” error.

Save your file with the file extension .bat, e.g. run-exe-program.bat and double click on it to run the .exe program.

To prevent auto-closing of a console after execution of a batch file (useful for debugging), add the pause:

start "" "C:\Path\Program.exe" /param1 /param2
pause

You may also find it useful to suppress the output by turning the @echo off:

@echo off
start "" "C:\Path\Program.exe" /param1 /param2

Cool Tip: Get the return code from the last command or application! Read more →