Writing your first BATch file
Generally speaking, batch files (files with the BAT
extension such as AUTOEXEC.BAT
) are text files that
can contain a list of multiple commands to be executed.
For example, you could write a BAT
file to copy multiple files or change the directory or
anything you can do using the "Command/DOS
It's very easy to create
- Go to the "DOS Prompt"
or "Command Prompt"
- Type following commands in red line by line
(press ENTER after
COPY CON MYBAT.BAT
ECHO Hello, world! This is my test BAT file!
Please note that "^Z"
is a single character produced by pressing CTRL+Z
- Run newly created BAT file by typing "MYBAT" and pressing ENTER.
In the above code, we're first saying "hello" to the world, changing
the current directory to "C:\WORK\9TO5\FOLDERA"
(example directory - you may type in your mostly visited
directory here), and finally getting the directory of
Although we used the command line to create "MYBAT.BAT" itself, you can
create your future BAT files
using any text editor. You can then experiment with
different commands in your new BAT
Applicable Keywords : MS-DOS, Windows NT, Windows NT 3.x, Windows NT 4.x, Windows, Windows 3.x, Windows 95