| by Arround The Web | No comments

How to Execute a BAT File on Windows

A BAT file is a script that stores command and execute in serial. It is used to perform routine tasks on Windows without the need for user intervention. In this guide, we will cover how to create a BAT file and a procedure to run that type of file.

How To Execute a BAT File on Windows

Creating a BAT file in Windows is not very complicated. Below are a few steps to follow to create a BAT file:

Step 1: Search for Notepad in the Start menu and open it:

Step 2: Type the following lines in the Notepad:

@ECHO OFF
ECHO Hello World! Linuxhint is the best tech guide to learn all about Windows.
PAUSE

Step 3: Click on File at the top left, then click Save As:

Step 4: Now save this file with the desired name adding .bat at the end of the name, afterward click on Save:

How To Execute BAT File on Windows

We don’t need to download any special software to run BAT files on Windows. They can be run from the file explorer or through the Command prompt:

Method 1: Run BAT Files from File Explorer

Open the File Explorer from the Start menu and navigate the BAT file you want to run. Right-click on the file and click on Run as administrator from the context menu:

Your file will open like this:

Method 2: Run BAT Files Through the Command Prompt

Search for the Command prompt in the start menu and run it as administrator. Now copy the path of the file from File Explorer and paste the below command, then type the name of the file including the extension then press enter:

C:\Users\Hassaan Tahir\Documents\Linuxhint1.bat

Conclusion

To Execute the BAT file, there are primarily two ways, one is by clicking on run as administrator in the right-click menu. The other is by using the command prompt and for that open the Command prompt as administrator and typing the file address and file name with extension as the command, then pressing enter.

Share Button

Source: linuxhint.com

Leave a Reply