Question:

How can I make and save a batch file in DOS?

by  |  earlier

0 LIKES UnLike

How can I make and save a batch file in DOS?

 Tags:

   Report

1 ANSWERS


  1. Assuming you have full DOS 6.20 you need to use the edit program for text editing and you need to name your batch file with .bat extension.

    To do this, you need to type at the command prompt "edit myfile.bat" (without the quotes) where myfile.bat is the name of your batch program (note the .bat part which is improtant). Once the editor opens you can type DOS/batch commands (e.g. echo Hello) and then you need to save the file (go to File menu and then Save). To run your batch program, just type myfile in the directory where you have run the edit command.

    In case you don't have the edit command or other editor available (e.g. very old version of DOS) you can use echo to create a batch file. This is painful. To do that you need to type the following command on the command prompt for every line of your batch file. Watch for typos because there is no simple way to correct any typos. So, the command is:

    echo your command >> myfile.bat

    where "your command" is anything you want to put in the batch file and myfile.bat is again the name of your batch file. For example you coud type:

    c:\> echo echo hello >> myfile.bat

    and then do c:\> myfile

    and you will get a hello on the screen.

    You can find more info on MS-DOS batch files on:

    http://www.microsoft.com/technet/archive...

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.