Windows 10

How to Create a Batch File in Windows

In this tutorial, we are going to see how to create a batch file in Windows. Creating your own Bat files is useful when you need to perform a sequence of commands repeatedly and want to automate their execution. For example, this could be login procedures or a program, which has to run continuously in the background. In this tutorial, we are going to see the tools you need to create batch files and explain in detail how to create, save and run your own batch files.
Batch File Commands List With ExamplesBatch File Commands List With ExamplesIn this tutorial, we are going to see a list of batch file commands with examples. Batch files are batch files that allow Windows users…Read More

 

How to Create a Batch File in Windows

To create a batch file in Windows follow the next steps:
 

Step 1: Select and start an editor

Text documents form a suitable basis for batch scripts. To write your own batch file, a common text editor is sufficient. Since features such as syntax highlighting are not really necessary, the default Microsoft editor for Windows, also known as Notepad, is all you need. To open it, simply type the Notepad into the Windows search and click on the corresponding icon displayed in the results:
 


 

Step 2: Create and save a new batch file

To make your first steps in writing a batch file easier, we encourage you to create a simple script that will simultaneously create several directories. If you create, for example, a Bat file by entering the following, running it will generate two directories “Test1” and “Test2” on the C drive:

MKDIR C:\Test1
MKDIR C:\Test2

Simply copy the two lines into an empty document opened in Notepad, as shown in the following screenshot:
 


 
 
To save these Bat instructions, click on File and select the Save as… menu item.
 

 
Enter the desired save location and the name you wish to give the scripts, including the .bat file extension, in the File Name field:
 

 
How to Run Batch File in CMDHow to Run Batch File in CMDIn this tutorial, we are going to see how to run a batch file in CMD. CMD is one of the oldest software components of…Read More

Leave a Reply

Your email address will not be published. Required fields are marked *