How to make a batch file for Windows Computers

How to make a batch file for Windows Computers

Xtreme Tech Tips

In this tutorial we will teach how to make a Windows batch file in 5 simple steps.


What is a batch file?

A batch file is a file on Windows that can execute commands and do tasks. It's very useful to complete specific tasks while only pressing one button!


For example, someone can make a batch file that Downloads and installs an app on your computer!


How can I make one?

Let's get started!!! It is very simple!


1. Open Notepad. Type in the following:

@echo off
echo hello, World!
pause
echo Credit to Xtreme Tech
timeout /t 3 > nul
echo bye
timeout /t 3 > nul
exit


This is how notepad should look



2. Press CTRL + S to save file - and choose the Downloads folder. 

- Make the filename test.bat 

- Save as type: All files (*.*)

- Press Save

Make sure you save the file under these settings!


3. Open File explorer and navigate to the Downloads Folder

5. Find test.bat, and double click it!!! Enjoy!


The Batch file in Action!


Great, but what was that?

Let's go through the lines one by one so you actually understand what that did.


  1. @echo off: This just tells the computer not to show each command on the screen before it runs.
  2. echo hello, World!: This line says "Show the words 'hello, World!' on the screen."
  3. pause: This makes the computer wait for you to press a key before moving on.
  4. echo Credit to Xtreme Tech: This line says "Show the words 'Credit to Xtreme Tech' on the screen."
  5. timeout /t 3 > nul: Wait for 3 seconds. The >nul means that it wont print any output from that command onto the screen. You can use it at the end of any command to block it from showing output!
  6. echo bye: This says "Show the word 'bye' on the screen."
  7. timeout /t 3 > nul: Wait for another 3 seconds without showing anything.
  8. exit: This tells the computer to finish and close the window.

So, in super simple terms, it's like a little program that says hello, gives credit, says bye, and waits a bit between each thing.




Credit: Xtreme Tech Tips

Telegram: @xtremetechtips

Subscribe Today for more tips and tricks!!!






Report Page