febooti softwarehome of febooti softwarefebooti software

stopping a DOS batch file

Batch files
homenewsproductsdownloadsorderingsupportcontacts
show Quick Links
hide Quick LinksQuick Links: Command line email home | Online help | Commands | Batch files | FAQ | Buy now | Download


Usually, DOS executes a batch file without stopping. DOS stops processing the batch file while the program runs when the batch file loads a program. As soon as you exit the program, or an automatic termination occurs, DOS immediately continues processing the batch file from where it left off. Typically this is what you want, but sometimes you want to give the user time to think, react, and then take action. An example would be giving the user a group of choices that you want them to select from before proceeding.

PAUSE is the command we are looking for. PAUSE stops the batch file until almost any key is pressed. A key that would produce a character on the screen needs to be pressed. Therefore pressing a key like Ctrl or Alt or Shift will not exit out of the pause status. We used this command above to see the output. Now we will use this to pause the execution of the batch script.

Though the PAUSE command is really quite helpful, it lacks in power. The keystroke that you press is not capable of being used as a menu selection nor can it be saved in the program in any other way. Below is an example to illustrate how the PAUSE command works along with the ways of terminating a program with the keyboard.

1:
2:
3:
4:
5:
6:
7:
8:
9:



:: PAUSEIT.bat
:: Example of the PAUSE command
:: and the ways to exit out of a program

@ECHO OFF
ECHO The next command is a PAUSE
ECHO Do NOT press Ctrl+C or Ctrl+Break
PAUSE
ECHO Press Ctrl+C or Ctrl+Break
PAUSE
Type text Copy text

The first line is a comment with the name of the file. The second and third line comment is a description of the program (batch file). The fourth line turns command-echoing off. Line 5 and 6 gives the first message about which keys you can press for the first example. Line 7 is the PAUSE command that stops the batch file until a key is pressed. The next line (8) displays the message about aborting the program using the keyboard controls. The last line (9) is the final PAUSE that finishes the program.


Previous DOS batch commandDOS batch command 7 of 11
Return to Origin
Next DOS batch command



Look closer
febooti Command line email utility - send email directly from DOS command line (MS-DOS prompt)
febooti ieZoom toolbar: zoom Browser pages (Internet Explorer)
febooti fileTweak: utility to change file date and time


How to?
Command line e-mailer for windows - adding comment and org
How to use -LOG command with DOS mail
febooti Command line email utility - full list of parameters


Links
febooti software affiliate program
Link to us!
Links


febooti softwarehome of febooti software
back to top
Copyright © 2001-2006 febooti software. All rights reserved.
Copyright © 2001-2007 febooti software. All rights reserved. Last Updated: August 28, 2005