If you are a regular Windows 10 user, then you must be familiar with the power of the Command Prompt. However, some people do want to use the wonders of Command Prompt but they do not like its dull interface. Therefore, they want some sort of magic through which they can simply take advantage of the Command Prompt without even having to write commands on it every time. Well, the magic lies behind the batch scripts. In this article, we will explain to you the method through which you can write a batch script in Windows 10.
Writing a Batch Script in Windows 10
In order to write a batch script in Windows 10, you will need to perform the following steps:
Type notepad in the search section of your taskbar and click on the search results to launch the new notepad document. The newly opened Notepad document is shown in the following image:
Now type the following commands in your newly opened Notepad document:
ECHO OFF ECHO My First Batch Script PAUSE
These commands are also highlighted in the image shown below:
Once you manage to write your first and most simple batch script, you need to save this file. For doing that, click on the File tab located on the Menu Bar of the Notepad document as highlighted in the following image:
As soon as you will click on the File tab, a pop-up menu will appear on your screen as shown in the image below:
Now click on the Save As option from this menu as highlighted in the image shown above.
As soon as you will click on this option, the Save As dialogue box will appear on your screen as shown in the following image:
Now name this newly created batch script according to your own choice followed by the “.bat” extension. In this example, I have named the batch script file as “FirstBatchScript.bat”. Once you have typed in the desired name for your batch script, click on the Save button as highlighted in the image shown above.
You will need to run this batch file now. For doing that, first, locate the place where you have saved your batch file as highlighted in the image shown below:
Now double click on your batch file in order to run it as highlighted in the image shown above.
As soon as you will run this batch script, the message that you have written in it while creating it will be displayed in your Command Prompt window. In this example, you will be able to see the message “My First Batch Script” as highlighted in the following image:
Now you can press any key from your keyboard in order to close this window.
By following the method discussed in this article, you can easily write a batch script in Windows 10 and hence save yourself from writing complex commands on Command Prompt because now, you can simply run those commands just by running the batch script that you have created.