Thursday, January 16, 2014

Batch file for execution of multiple commands


There are only three kinds of file in DOS which are directly executable. These are .exe, .com,and .bat. Out of these, .exe and .com are executable files. The .bat is batch file or a scripting file.


Whenever we want to execute multiple commands at a time, we may use the batch file. We just need to add all commands in a file whose extension is .bat. This is very usefull while executing a assembly language program.
For example, you have written a program named myprog.asm and you want to assemble, link and execute in one command. Then just create a file called run .bat and type in it.

   masm myprog.asm;
   link myprog;
   myprog

This file must be present in your current working directory. i.e /masm. Now, after typing 'run' (name of batch file ) on terminal all above commands will get executed.

See the screenshots below:



Final execution:

2 comments: