Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-01-2011
Member
 
Join Date: Sep 2010
Posts: 59
Viewing messages with a batch file

If MS-DOS should display a message that you use in your batch program echo command, like this example:
echo text files are saved to drive A
to prevent MS-DOS displays commands as they are running, use the following command:
echo off
You can insert messages into a batch program so that you will be prompted to enter additional information or recalls a special batch program from the task performed. If MS-DOS should display a message on your screen, use the echo command. For example, the following command tells MS-DOS "Insert a floppy disk in drive A," the message, type:
echo A disk in drive A, insert
In a network environment, your message will be displayed more quickly if you paste it into a .Txt file and type in the batch program use the command to display the message. MS-DOS displays this message on the screen. If the message type is to be moved by a certain number of spaces to the right, you need the spaces as part of the message. If the message is displayed on the screen, for example, centered, add the necessary spaces to the command:
echo A disk in drive A, insert
If you want to skip a line, type echo after a dot:
echo.
Reply With Quote
  #2  
Old 07-01-2011
Member
 
Join Date: Sep 2010
Posts: 59
Re: Viewing messages with a batch file

If echo is turned on, MS-DOS commands from the batch program during its execution. Therefore ("Insert a disk in drive A") the message from the previous example is shown twice: the first time at the command prompt as part of the batch command, and the second time in the form of a command prompt as a result of the command. Thus, a message appears only once, you must ensure that commands are displayed at the command prompt and enter the following command for this purpose:
echo off
An example: You could at the beginning of the file described in the previous section SAVE.BAT add the command echo off:
echo off

copy c: \ recipes \ crab \ *- doc a: copy c: \ reports \ January \ bak *- a: cls
This batch program saves the information in two lists of files with a .Doc and .BAK clears the screen and displays the directory listings at a time. Commands that are listed after the first command (echo off) will not be displayed during the execution of the batch program. The line of text that is after the second echo command is, however, appear. This notice will not see a single command in your batch program, enter the command before the @ sign. For example, to display the echo command to prevent off, type @ echo off.When commands are displayed, use the beginning of the batch program this command:
echo on
Reply With Quote
  #3  
Old 07-01-2011
Member
 
Join Date: Sep 2010
Posts: 66
Using the replaceable parameter $ *

You can use the replaceable parameter $ * to all of the text of the command to start a macro, followed by, a single parameter assign. Usually, different MS-DOS parameters by a space looking for. The text between the first two spaces is the first parameter, the text between the second and third spaces, the second parameter and so on. If you use the replaceable parameter $ * but passes Doskey space and has all the text to the parameter $ * to. The parameter $ * is particularly useful if the created macro variable number of parameters used one. You can, for example, the following command to create a macro called d, the abbreviation of the command will allow you to:
doskey d = dir $ *
Regardless of the number of parameters specified macro does this as well as the dir command. All the following commands for example, the macro d just like using the command you run with:
.. TXT

*. Txt / s

.. TXT / s / b
If the macro parameter $ 1 instead of $ * to use, replace MS-DOS, the first parameter and passes the rest of the command line.
Reply With Quote
  #4  
Old 07-01-2011
Member
 
Join Date: Sep 2010
Posts: 48
Working with Batch Programs

While working with MS-DOS, you will find that you need to enter commands always follow the same. You could, for example, always enter the same three commands to change the current drive to, to change the current directory and then start a program. If you are using MS-DOS, you can in a batch program or a batch file save commands. Rather then enter the commands individually, you need the name of the batch program is type. In response, these MS-DOS "batch" of commands from the same as if you had typed individually, the keyboard on it. A batch program is a plain text file containing one or more MS-DOS commands. For example, a batch program example, the commands have to, that you change the directory and start a text editor. Suppose, for example, use the following commands to disk backup copies of files to create one at:
cd \ word \ textdat copy *- doc a:

cd \ reports \ XDAT

*- doc copy a:
these four commands in a batch program sum up, save it in a plain text file and have the file extension. BAT to. Then you can always, if you want to back up your files, the command prompt, type the name of the batch program to enter. Using batch programs has the following advantages:
  • batch processing programs to accelerate your work. If you run a program of this kind, you need only a single command instead of multiple commands notice. You do not need to enter multiple commands again and again or look up commands to which you can no longer remember.
  • batch processing programs to fit MS-DOS on an individual basis. Using batch programs, you can create your own command lists that are automatically executed then. You can also customize your own needs and messages prompts.
Reply With Quote
  #5  
Old 07-01-2011
Member
 
Join Date: Jul 2010
Posts: 75
How to create a batch file

With you can copy the command batch program directly from the keyboard to create a. For example: You want to create a batch program that your floppy drive with high storage density, a 360 KB floppy disk formatted. To create this file and call them to MEINFMT.BAT, use the following copy command:
copy con c: \ meinfmt.BAT
MS-DOS moves the cursor to the next line. At this time the file is empty. In order desired format command to add the file, type the following:
format a: / f: 360
You can now close the file and to MS-DOS prompt return. Do this, press CTRL + Z and then ENTER. Once you have created the batch program, you need only enter its name to floppy disk drive with high storage density, a 360 KB floppy disk to format in your:
meinfmt
MS-DOS displays the format command on the screen and prompts you to insert a disk into drive A. (Make sure that the batch file in the current directory or the directory is included in the command search path.) The next batch program, SAVE, is also short enough to create the command to copy with.
copy con c: \ secure-baf
This program ensures all in two directories on a hard drive or stored on DOC. And BAK files on a floppy disk and then displays a list of backed up files on the disk:
copy c: \ books \ hack \ *- doc a: copy c: \ reports \ January \ bak *- a: dir a:
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Viewing messages with a batch file"
Thread Thread Starter Forum Replies Last Post
make file name list in excel using batch file shibinpanayi Windows Software 1 04-06-2011 03:44 AM
Windows Batch file to output directory names and size to txt file m2thearkus Software Development 6 16-07-2010 12:04 AM
Viewing large file Beryl Windows Software 4 27-05-2010 05:58 PM
Dos batch file to sort files based on file names. Jon Osborn Windows Server Help 9 17-06-2009 11:06 AM
Batch file to copy a file from the local drive to a computer on lan? dudelearn Tips & Tweaks 3 12-03-2009 12:56 PM


All times are GMT +5.5. The time now is 08:35 AM.