All Notepad Batch Commands – Ultimate Guide

Most of the people think notepad is only made to save notes or texts. But few people are there who know the real power of notepad. As an in-built feature in windows, notepad can be used to make HTML ( Hyper Text Markup Language “.html” ), Batch ( “.bat” ), CPP ( “.cpp” ), JS ( Javascript “.js” ), CSS ( Cascade style sheet “.css” ), JAVA ( Java Source File ) etc Files.

In This Chapter, we only focus our mind on Batch Programming.

All You Need To Know About Batch Programming

What Is Batch ?


Basically batch is a scripting language which works in windows, DOS and OS 2 platform and can be programmed in notepad or simply in windows Command Prompt Shell. It Consist of simple commands to be executed by command line interpreter. The file extension type of batch program is “.bat”.

Simple Example Of Batch Program


Below is the simplest code snippet for batch program which is nothing but a hello world program. After execution, this program will display “Hello world” on your computer screen.

Hello World Batch Program

@echo off

Title Hello World Program

Color 0a

Echo Hello World

Pause>nul

Exit

How To Save And Execute Batch Program

So you are newbie in batch programming and don’t know how to save and execute above program. Don’t panic, this tutorial will be your next milestone. We will introduce you with the simplest to the most hardest commands here.

Save Hello World Batch Program


To save above program, just copy it and paste inside notepad. Then click on “file>save as” and name it as “hello world.bat” or anything you want. Make sure that you had used “.bat” after file name, because it the file extension type and your program will not work without it. After that Choose File Type as “all files (*.*)” and move to the location where you want to save it. Finally when you have done, Click on the program and it will display a text as in below picture.

Note : We recommend You to use notepad++ instead of simple notepad as it is more responsive.

Some Important Batch Commands And Their Explanation

Below are all the batch or command prompt commands that will definitely help you to get some new ideas.

Command Explanation
ASSOC Displays or modifies file extension associations.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
BCDEDIT Sets properties in boot database to control boot loading.
CACLS Displays or modifies access control lists (ACLs) of files.
CALL Calls one batch program from another.
CD Displays the name of or changes the current directory.
CHCP Displays or sets the active code page number.
CHDIR Displays the name of or changes the current directory.
CHKDSK Checks a disk and displays a status report.
CHKNTFS Displays or modifies the checking of disk at boot time.
CLS Checks a disk and displays a status report.
CMD Starts a new instance of the Windows command interpreter.
COLOR Sets the default console foreground and background colors.
COMP Compares the contents of two files or sets of files.
COMPACT Displays or alters the compression of files on NTFS partitions.
CONVERT Converts FAT volumes to NTFS. You cannot convert the current drive.
COPY Copies one or more files to another location.
DATE Displays or sets the date.
DEL Deletes one or more files.
DIR Displays a list of files and subdirectories in a directory.
DISKCOMP Compares the contents of two floppy disks.
DISKCOPY Copies the contents of one floppy disk to another.
DISKPART Displays or configures Disk Partition properties.
DOSKEY Edits command lines, recalls Windows commands, and creates macros.
DRIVERQUERY Displays current device driver status and properties.
ECHO Displays messages, or turns command echoing on or off.
ENDLOCAL Ends localization of environment changes in a batch file.
ERASE Deletes one or more files.
EXIT Quits the CMD.EXE program (command interpreter).
FC Compares two files or sets of files, and displays the differences between them.
FIND Searches for a text string in a file or files.
FINDSTR Searches for strings in files.
FOR Runs a specified command for each file in a set of files.
FORMAT Formats a disk for use with Windos.
FSUTIL Displays or configures the file system properties.
FTYPE Displays or modifies file types used in file extension associations.
GOTO Directs the Windows command interpreter to a labeled line in a batch program.
GPRESULT Displays Group Policy information for machine or user.
GRAFTABL Enables Windows to display an extended character set in graphics mode.
HELP Provides Help information for Windows commands.
ICACLS Display, modify, backup, or restore ACLs for files and directories.
IF Performs conditional processing in batch programs.
LABEL Creates, changes, or deletes the volume label of a disk.
MD Creates a directory.
MKDIR Creates a directory.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top