I thought I might share some of my knowledge with you all, so I decided to make this. In this tutorial you will be learning about the basics of batch file scripting. To write a batch file, all you need is notepad. So let's get started!
Start off by opening up notepad. Once you have done that, enter this:
@echo off
Add that to the first line. What this does is it stop file path info from being shown, it makes your batch file look a lot neater, just make sure you have that there. On the next line, we are going to set a title.
title MY TITLE
That's an example on how to set a title called "MY TITLE" just change that to what you want your title to be. On the next line, let's make our batch file say something! To do that, use the "echo" command. Type echo and then what you want it to say. So for example:
echo Hello World!
That would make it say "Hello World!" Now if we run our batch file right now, it would close automatically. Why? Well we forgot the pause command. The pause command stops the batch file from closing. It will display a message saying "Press any key to continue..." and then when the user presses a key, it moves on to the next line of code. So now, just add more echo and pause commands. You should have something like this now:
@echo off title MY TITLE echo Hello world! pause
Add more echo and pause commands now, my batch file looks like this:
@echo off title MY TITLE echo Hello World! pause echo Hi! echo G2G pause
Now it's time to actually run our batch file! But before we can do that, we need to save the file. Click File > Save As. Name it anything you want but at the end of the file name put in ".bat" to make it a batch file. Then for the "Save as type" select "All Files" not "Text Files"... this is very important. Now run the file you just made. Here is mine:
Congratulations on writing your first batch file! If you have any questions or if you have encountered a problem, feel free to contact me, I am willing to help. Thanks for reading this guide, I hope it taught you something.
Best Regards,
-Ebsuru