home *** CD-ROM | disk | FTP | other *** search
-
- --| CUSTOMIZING YOUR MS-DOS PROMPT |--
- Basic and advanced usages of the "prompt" command
-
- Mike Guffey/BBL126 on "THE SOURCE"
- MGUFFEY on MCIMAIL
-
- [This article assumes the reader has progressed beyond
- the status of novice DOS user and can decipher some of
- the less cryptic passages in Microsoft DOS
- documentation. Where additional instruction might
- help, another source of information will be cited.
- Technical explanations of what is happening will not
- appear here.]
-
- Your MS-DOS or PC-DOS (2.1 or above) documentation
- lists a resident (built-in) command which allows you to
- change the A> or B> prompt. Depending on your
- particular documentation, you may be able to use some
- of this command's features, but probably not all (until
- you read the article below). This is an overview of
- just what you can do with the "prompt" command.
-
- Most documentation explains (usually less than lucidly)
- how to change the basic A> or B> prompt. But some
- MS-DOS users never realize that in addition to the
- basic options of "prompt", they can probably:
-
- - cause the prompt to display in reverse video
- (text in normal video)
- - redefine the ten function keys
- - redefine the Cntl, Alt, and Shift combinations
- of the ten function keys
- - redefine other keys as well
- - perform these "tricks" from the DOS command
- line or with .BAT files
-
- ==> Basic Nifty Tricks
-
- Why change the DOS prompt from the basic A> or B>?
- Let's suppose that for some reason or another you have
- either different versions of DOS on different disks or
- the DOS COMMAND.COM file on several specific-function
- disks. It might be nice to know whenever you are at
- the command level either which version of DOS you are
- using or which special function disk you are using. Or
- perhaps you don't use an onboard clock and might find
- it handy to display the time each time the prompt is
- displayed. Or maybe you are simply tired of the
- humdrum A> or B>.
-
- It is these needs that most DOS documentation
- addresses. But many of us never read
- documentation/instructions unless all else fails. So,
- here are a couple of quick examples of what "prompt"
- can do. [For additional instruction, read/re-read your
- DOS documentation or obtain the excellent book,
- "RUNNING MS-DOS" by Van Wolverton (ISBN 0-914845-07-1)]
-
- The "prompt" command has several operators/characters
- that produce specific results. In order to use them,
- they are preceeded by a dollar sign. Several or all of
- these operators can be used on the same command line
- (or within the same .BAT file). When invoked, they are
- NOT separated by spaces.
-
- For example, the command:
-
- prompt $t_$v_$p_QMODEM IN A ==> THIS IS DRIVE $n$g
-
- might display: 15:36:03.63
- IBM Personal Computer DOS Version 2.11
- Current Directory = B:\
- QMODEM IN A ==> THIS IS DRIVE B>_
-
- A detailed discussion is pointless here. (The
- operators are listed in your DOS documentation.} You
- can do several things after reading your own basic
- "prompt" documentation. But very seldom will you
- encounter this information: Typing the "prompt" command
- without operators (arguments) will restore the basic A>
- or B> prompt. (But it will not cancel everything you
- can achieve with the "prompt" command.) This is nice
- to know if you are doing alot of disk swapping and it
- no longer becomes important to know some of what the
- "prompt" command will tell you. So the above complex
- display will cease and merely show the current drive if
- you will type the "prompt" command on a line by itself
- and follow it by a <RETURN> or an <ENTER>.
-
- ==> Intermediate Level Trick
-
- Some of use are always meddling. For those of us who
- do, there is another feature of the "prompt" command
- which will allow the prompt to be displayed in reverse
- video and the other command line data in normal video.
- This will not work in all situations. You will need to
- be using the normal ANSI.SYS device driver on your
- initial COMMAND.COM disk.
-
- For example, the command:
-
- prompt $e[7m$n$g$e[m
-
- will cause the normal A> or B> prompt to appear in
- reverse video. The remainder of the command line (what
- you enter) will appear in normal video.
-
- And, for example:
-
- prompt $e[7m MSDOS $n$g$e[m
-
- might cause the prompt " MSDOS A>" to appear in reverse
- video. The leading blank makes the display more clear
- on some monitors. [The "$n" above will cause the
- letter of the currently logged drive to appear in the
- command line.] Remember ==> this trick will NOT work
- if you are not using ANSI.SYS in a normal fashion on
- the COMMAND.COM disk you initially boot the system
- with.
-
- Some users will discover that by playing with the
- sequences following "$e" above, they may acheive some
- interesting results on color monitors. The "$e" allows
- usage of an "escape sequence" and is beyond the scope
- of this article. {Hint: "[m" = "[0m"}
-
- ==> Advanced Level Usage
-
- One of the most interesting uses of the "prompt"
- command was recently discussed by Harold M. Bauman in
- his Heath/Zenith column in the June '85 issue of
- "COMPUTER SHOPPER". His techniques apply to almost all
- IBM compatibles and are explained in less technical
- fashion below. The "prompt" command can be used to
- redefine keys either from the DOS command level or with
- use of a .BAT file. The keys can either be redefined
- one-at-a-time or in a sequence of commands. So =YOU=
- can determine the definition of some keys to be
- anything from a single keystroke to numeric formulas to
- complex strings of data. [Harold Bauman's column is a
- little more comprehensive in explaining some of the
- other possibilities of this technique than the
- description below.]
-
- This means that in many applications, you do not need
- commercial or public domain software to redefine keys.
- You can do it yourself. But... it will not work with
- all applications programs and it may interfere with or
- override the preset definitions of some software. It
- may be of use in adding additional keyboard definitions
- to programs which have only a limited number of
- specially defined keys. (For example, SYMPHONY only
- uses about 23 of the possible 40 function [F] key
- combinations.)
-
- The syntax of the basic redefinition command is as
- follows:
-
- prompt $e[0;n;"def";13p 1 - basic setup, needed in
- ^^^^^^^^^^^ most definitions
- 11111111111 ^ 2 - numeric value of key
- 2 ^^^^^ to be redefined (see
- 33333 ^^^ appendix B)
- 444 3 - alphanumeric string
- prompt assigned to the key
- ^^^^^^ (quotes required)
- 555555 4 - places a <RETURN> at
- string; deletion of 13
- ends string w/o <RETURN>
- 5 - see note 4 in APPENDIX A
-
- Here is an example of what can be done from the command
- level:
-
- prompt $e[0;68;"DIR /p";13p
- prompt
- redefines F10 to give a paged
- DIR command of logged drive and
- restores basic MSDOS prompt
-
- A .BAT file can be created to define keys more simply
- and without having to worry about getting the syntax
- exactly right for each definition. The following is an
- example you might call DEFINKEY.BAT:
-
- prompt $e[0;%1;%2;%3;13p
- prompt
-
- Then, the command sequence
-
- DEFINKEY 68 DIR /p<RETURN>
-
- will acheive the same results as the more complicated
- example above. This method can allow strings of up to
- 8 words (alphanumeric combinations separated by spaces)
- to be defined. [The %1 above is used to allow for the
- redefined key to be specified. %2 and %3 are for the
- two "words" in the string.]
-
- Commands can also be added to an AUTOEXEC.BAT file to
- define several keys on start-up. In such situations,
- the full syntax "prompt" commands should be used to
- avoid confusion and to maintain consistency on each
- startup.
-
- This undocumented usage of the DOS "prompt" command has
- many possibilities limited only by a users' imagination
- or willingness to experiment. There is more to this
- "trick" than an alternative to key redefinition
- software. It is a demonstration of the real power of
- Microsoft DOS.
-
-
- APPENDIX A
- ----------
- when redefining keys with "prompt":
-
- 1> the new definitions will NOT be recognized by
- programs or applications which bypass DOS to get
- keyboard information. BASIC is an example.
-
- 2> use of the "prompt" command without operators or
- arguments will NOT restore the original keyboard
- definitions. The system must be re-booted (i.e.
- Cntl-Alt-Del).
-
- 3> if keys are redefined with "prompt" in a .BAT file,
- the ECHO command must be =ON= or the redefinitions will
- not be recognized.
-
- 4> after a sequence of redefinitions with "prompt", the
- MSDOS prompt itself must be redefined (as shown in the
- Basic section above) or the "prompt" command (without
- operators) must be entered. Otherwise there will be no
- prompt at the MSDOS command level and the cursor will
- blink at the far left column.
-
-
- APPENDIX B
- ----------
- Key values used for redefining keys with "prompt"
-
- F1 = 59 F2 = 60 F3 = 61 F4 = 62 F5 = 63
- F6 = 64 F7 = 65 F8 = 66 F9 = 67 F10 = 68
-
- Shift-F1 = 84 Shift-F2 = 85 Shift-F3 = 86 Shift-F4 = 87
- Shift-F5 = 88 Shift-F6 = 89 Shift-F7 = 90 Shift-F8 = 91
- Shift-F9 = 92 Shift-F10 = 93
-
- Ctrl-F1 = 94 Ctrl-F2 = 95 Ctrl-F3 = 96 Ctrl-F4 = 97
- Ctrl-F5 = 98 Ctrl-F6 = 99 Ctrl-F7 = 100 Ctrl-F8 = 101
- Ctrl-F9 = 102 Ctrl-F10 = 103
-
- Alt-F1 = 104 Alt-F2 = 105 Alt-F3 = 106 Alt-F4 = 107
- Alt-F5 = 108 Alt-F6 = 109 Alt-F7 = 110 Alt-F8 = 111
- Alt-F9 = 112 Alt-F10 =113
-
- Alt-1 = 120 Alt-2 = 121 Alt-3 = 122 Alt-4 = 123
- Alt-5 = 124 Alt-6 = 125 Alt-7 = 126 Alt-8 = 127
- Alt-9 = 128 Alt-0 = 129 Alt-- = 130 Alt-= = 131
-
- Alt-A = 30 Alt-B = 48 Alt-C = 46 Alt-D = 32 Alt-E = 18
- Alt-F = 33 Alt-G = 34 Alt-H = 35 Alt-I = 23 Alt-J = 36
- Alt-K = 37 Alt-L = 38 Alt-M = 50 Alt-N = 49 Alt-O = 24
- Alt-P = 25 Alt-Q = 16 Alt-R = 19 Alt-S = 31 Alt-T = 20
- Alt-U = 22 Alt-V = 47 Alt-W = 17 Alt-X = 45 Alt-Y = 21
- Alt-Z = 44
-
- -end-
-
- = 16 Alt-R