How to Run .exe File From the Command Prompt Using a Batch Script

MD Aminul Islam Feb 02, 2024
  1. Use the Title and Location to Run .exe File From the Command Prompt Using a Batch Script
  2. Use the Location and Filename to Run .exe File From the Command Prompt Using a Batch Script
How to Run .exe File From the Command Prompt Using a Batch Script

This article will show how we can run a file with the type .exe using a Batch (.bat) script.

There are two different commands you can use for this purpose. Let’s discuss each method in the following sections.

Use the Title and Location to Run .exe File From the Command Prompt Using a Batch Script

If you know the Window’s title of the file and have the exact location, you can use the command in the following format.

start "Windows Title" c:\Location\file.exe

The example below will open the notepad.exe file.

Example code:

start "Notepad" c:\windows\system32\notepad.exe

Use the Location and Filename to Run .exe File From the Command Prompt Using a Batch Script

You can also use the below command to open a .exe file. To use this command, you need the location and the file’s name.

The general format for this method is shown below.

start "c:\location\" file.exe

We are going to open notepad.exe using this command.

Example code:

start "c:\windows\system32" notepad.exe

Remember all methods discussed here are written using a Batch script and will only work in the Windows CMD.

MD Aminul Islam avatar MD Aminul Islam avatar

Aminul Is an Expert Technical Writer and Full-Stack Developer. He has hands-on working experience on numerous Developer Platforms and SAAS startups. He is highly skilled in numerous Programming languages and Frameworks. He can write professional technical articles like Reviews, Programming, Documentation, SOP, User manual, Whitepaper, etc.

LinkedIn

Related Article - Batch File