DISCLAIMER for anyone that knows the basics of tech knows what this is and won’t think this post is stupid pls skip this guide
A batch script is a list of commands that you can run automatically in the command prompt the batch script, all the commands are processed in order.
Getting Started
-
Creating the Batch Script
Open Notepad. This is where we’ll create our batch script. In Notepad, type the following:
@echo off
The
@echo off
command mutes all the commands in the script so that only the output is shown to the user. -
Adding Commands
On the next line, add:
echo Hello, Velt!
The
echo
command displays the text “Hello, Velt!” in the command prompt. -
Pausing the Script
To pause the script and wait for the user to press Enter, add this line:
pause
The
pause
command halts the execution and prompts the user to press any key to continue. This is useful if you want the user to read or do something before proceeding. -
Finishing the Script
Add one final command to indicate the script is done:
echo This batch script is done.
Your script should now look like this:
@echo off echo Hello, Velt! pause echo This batch script is done.
-
Saving the Script
Save the Notepad file by clicking File > Save As. In the “Save as type” dropdown, select All Files. Name your file
hellovelt.bat
and make sure it has the.bat
extension. -
Running the Script
Navigate to the location where you saved the file and double-click it to run the batch script. The output should be:
Hello, Velt! Press any key to continue... This batch script is done.
Congratulations! You’ve created and run your first batch script.
For a list of basic command check this out
If you found this useful, please give it a like!