MS DOS (CREATING BATCH FILE)

Batch files are files that contain a list of commands. It executes the commands within the file when you execute the batch file. The commands execute one by one. A command within a batch file can be used to start/run another application, for example you could start MS Word.
Why batch files are useful?
A batch file could be used to run frequently run commands, deleting a series of files, moving files, copying files etc. A simple batch file does not require any special programming skills and can be done by users who only know DOS commands.

Create your first batch file

  1. Open an MS-DOS command window.
  2. Change to the root directory of the C drive and create a directory called BatchFiles. You can use this directory to save your batch files.
  3. Change into Batchfiles folder. Create a new file called Ex1.bat using notepad.
  4. To do this type notepad ex1.bat at the command line.
  5. Type in the following lines into the file and Save. Each of the lines below is a command.
cls
ver
pause
dir c:\windows

  1. Before continuing, can you remember what the effect of each of the 4 commands that you have typed into the file? If not –  look them up in the help.
  2. Make sure you are in the Batchfiles folder.
  3. Key in DIR and MAKE SURE  you see a file called EX1.BAT
  4. At the prompt, type in the name of the batch file i.e. Ex1 and press Enter.
Understand the outcome.

Post a Comment

1 Comments

  1. Thanks for the Great Post about DOS Batch file system. Now I am Clear about the Batch................

    ReplyDelete