Category : Batch File Utilities - mostly for DOS
Archive   : BATDOC.ZIP
Filename : NOVBH_4.DOC

 
Output of file : NOVBH_4.DOC contained in archive : BATDOC.ZIP

NOVICE BAT-HINT # 4

**************************************************************************

from the BATHINTS library... part of the BATPOWER CONFERENCE from:

THE PAINFRAME OPUS/FIDO 261/1004

Baltimore, Maryland 1-301-488-7461

**************************************************************************

The PROMPT Command

Like the PATH command, the PROMPT command is simple and very powerful... and
also like the PATH, PROMPT is an environmental variable. The PROMPT command
controls the appearance of the DOS prompt displayed on the command line. The
default (normal) appearance of the DOS PROMPT is

A> or B> or C> etc...

depending on the current drive. If you do not specify a new PROMPT, then the
default PROMPT is used. Issuing the SET command would reveal no value for
the PROMPT environmental variable, if no new PROMPT command had been issued.

Again, like the PATH environmental variable, the PATH environmental variable
can be changed by entering

path $newvalue
or
set path=$newvalue

The PATH and PROMPT are the only two environmental variables whose values can
be entered into memory without the use of the SET command. In the examples
shown above the term "$newvalue" should be replaced by the actual value the
user whishes displayed at the command line... but a special code must be used.
Several books describe these values in detail... and of course, they are also
described in your DOS manual under the PROMPT command. The dollar symbol ($)
must precede each code letter when defining a new prompt. For example, the
default PROMPT is

prompt $g

where the letter "g" is the right carrot symbol (>). If you wanted to have the
current directory displayed, you might issue the following PROMPT command

prompt $p$g

If you were in drive A in a subdirectory called BATCH, this PROMPT would appear
as follows

A:\BATCH>

This is a very popular PROMPT, since your the drive and subdirectory in current
use is always displayed on the command line. You might also wish to have the
time displayed on the screen at the command line (my favorite type of PROMPT).
In this case you might issue the following PROMPT command

prompt $t$p$g

Again if in our example you were in drive A in a subdirectory called BATCH,
this prompt would appear as follows

23:09:22.46A:\BATCH>

But this prompt could be improved by placing a space between the time and the
drive letter A, and by getting rid of the last six characters shown in the time
(:22.46). To do this, issue the following command

prompt $t$h$h$h$h$h$h$ $p$g

Now the PROMPT would appear as follows

23:09 A:\BATCH>

Just as the letter "g" is for the right carrot (>), the letter "p" for the
path and the letter "t" for the time, the letter "h" is a backspace,
backspacing over the last six characters. If you wanted to put the time on the
line above the drive and path you would issue the following PROMPT command

prompt $t$h$h$h$h$h$h$_$p$g

This would create the PROMPT shown below

23:09
A:\BATCH>

Similarly, you might include the date in your prompt by using the letter "d".
Consult your DOS manual for a full list of items that can be displayed in the
PROMPT.

One last note... you can return to the default PROMPT at anytime by issuing the
PROMPT command without a new value. When you are familiar with the PROMPT
command, you might want to experiment with the use of escape sequences to
ANSI.SYS.

******************************************************* David Creasey


  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : BATDOC.ZIP
Filename : NOVBH_4.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/