Create a batch file (The funny part)

Create a batch file (The funny part)

Before creating a batch file you need to know what is a batch file by clicking here.

Download Notepad++ (Recommended for those who don't have any experience about batch file)

batch-file.jpg

How to create a batch file?

At first download and Install Notepad++(Also you can use normal notepad instead of Notepad++). Then open Notepad++ and create a new file by clicking File>New (Also you can use the keyboard shortcut 'Ctrl+N').

You need to follow some rules:
1.Use '@Echo off' command before typing any command. Because It will hide all commands which will perform before launching a batch file
2.Use 'Invited commands'(") while mentioning any path or file location. It will prevent to run any wrong command.
3.Use enter while writing too many commands. Because It will prevent from creating any wrong command.


Below is an example of a batch file


@echo off
title Example
echo This is an example of a batch file
pause
exit


  • Save the file, don't forgot to add .bat or .cmd extension.
  • Then open the file.
Notepad++ Commands



Output: You will get a similar screen as the below image

Example of a batch file (test batch file)

If you press any key on the keyboard then the back window will be closed.


Explanation: How It happens

Here title commands change the title of the command window screen (see above image) to 'Example',  then echo gives the message that "This is an example of batch file"

Also, you can change the mentioned text and the title of the window by changing the pink color text.

Download example.bat

If you are unable to create the above batch file then you can download the below file

How to edit the file??
Just right click on the file then click on 'Edit with Notepad++' (If your not using Notepad++ then click on the 'Edit' button)

Post a Comment

0 Comments