home *** CD-ROM | disk | FTP | other *** search
/ RBBS in a Box Volume 1 #3.1 / RBBSIABOX31.cdr / qbas / prompt.inf < prev    next >
Encoding:
Text File  |  1990-10-02  |  10.6 KB  |  272 lines

  1.  
  2.         --| CUSTOMIZING YOUR MS-DOS PROMPT |--
  3.       Basic and advanced usages of the "prompt" command
  4.  
  5.           Mike Guffey/BBL126 on "THE SOURCE"
  6.               MGUFFEY on MCIMAIL
  7.  
  8.    [This article assumes the reader has progressed  beyond
  9.    the status of novice DOS user  and can decipher some of
  10.    the     less     cryptic   passages   in   Microsoft   DOS
  11.    documentation.   Where  additional  instruction   might
  12.    help,  another  source  of  information  will be cited.
  13.    Technical explanations of  what  is    happening will not
  14.    appear here.]
  15.  
  16.    Your MS-DOS    or  PC-DOS  (2.1  or  above) documentation
  17.    lists a resident (built-in) command which allows you to
  18.    change  the    A>  or    B>  prompt.   Depending  on   your
  19.    particular  documentation, you may be able to use  some
  20.    of this command's features, but probably not all (until
  21.    you read the article below).   This    is  an overview of
  22.    just what you can do with the "prompt" command.
  23.  
  24.    Most documentation explains (usually less than lucidly)
  25.    how    to  change the basic A> or B>  prompt.     But  some
  26.    MS-DOS  users  never  realize  that in addition to  the
  27.    basic options of "prompt", they can probably:
  28.  
  29.    - cause  the prompt    to display in reverse video
  30.      (text in normal video)
  31.    - redefine the ten function keys
  32.    - redefine the Cntl, Alt, and Shift combinations
  33.      of the ten function keys
  34.    - redefine other keys as well
  35.    - perform these "tricks"  from  the    DOS command
  36.      line or with .BAT files
  37.  
  38.    ==> Basic Nifty Tricks
  39.  
  40.    Why    change    the  DOS  prompt from the basic A> or  B>?
  41.    Let's  suppose that for some reason or another you have
  42.    either different versions of  DOS on different disks or
  43.    the DOS  COMMAND.COM  file on several specific-function
  44.    disks.  It might be nice to    know  whenever    you are at
  45.    the command level either which version of  DOS  you are
  46.    using or which special function disk you are using.    Or
  47.    perhaps you don't  use  an onboard clock and might find
  48.    it handy to display the time each time  the    prompt    is
  49.    displayed.    Or  maybe you  are  simply  tired  of  the
  50.    humdrum A> or B>.
  51.  
  52.    It  is  these  needs   that     most    DOS  documentation
  53.    addresses.      But     many     of    us    never    read
  54.    documentation/instructions unless  all else fails.  So,
  55.    here are a couple of quick  examples  of  what "prompt"
  56.    can do.  [For additional instruction, read/re-read your
  57.    DOS    documentation  or  obtain   the   excellent  book,
  58.    "RUNNING MS-DOS" by Van Wolverton (ISBN 0-914845-07-1)]
  59.  
  60.    The    "prompt"  command has several operators/characters
  61.    that  produce specific results.  In order to use  them,
  62.    they are preceeded by a dollar sign.  Several or all of
  63.    these operators can be used on  the    same  command line
  64.    (or within the same .BAT file).  When invoked, they are
  65.    NOT separated by spaces.
  66.  
  67.    For example, the command:
  68.  
  69.    prompt $t_$v_$p_QMODEM IN A ==> THIS IS DRIVE $n$g
  70.  
  71.    might display: 15:36:03.63
  72.           IBM Personal Computer DOS Version 2.11
  73.           Current Directory = B:\
  74.           QMODEM IN A ==> THIS IS DRIVE B>_
  75.  
  76.    A  detailed     discussion   is   pointless  here.   (The
  77.    operators are  listed  in your DOS documentation.}  You
  78.    can do several things  after  reading  your    own  basic
  79.    "prompt"  documentation.   But  very  seldom  will  you
  80.    encounter this information: Typing the "prompt" command
  81.    without operators (arguments) will restore the basic A>
  82.    or B> prompt.  (But it will not cancel  everything  you
  83.    can    achieve with the "prompt" command.)  This is  nice
  84.    to  know if you are doing alot of disk swapping and    it
  85.    no longer becomes important to know    some  of  what the
  86.    "prompt" command will tell  you.   So the above complex
  87.    display will cease and merely show the current drive if
  88.    you will  type the "prompt" command on a line by itself
  89.    and follow it by a <RETURN> or an <ENTER>.
  90.  
  91.    ==> Intermediate Level Trick
  92.  
  93.    Some  of use are always meddling.  For those of us  who
  94.    do, there is another  feature  of  the "prompt" command
  95.    which  will allow the prompt to be displayed in reverse
  96.    video  and the other command line data in normal video.
  97.    This will not work in all situations.  You will need to
  98.    be using the normal    ANSI.SYS  device  driver  on  your
  99.    initial COMMAND.COM disk.
  100.  
  101.    For example, the command:
  102.  
  103.    prompt $e[7m$n$g$e[m
  104.  
  105.    will cause  the  normal  A>    or  B> prompt to appear in
  106.    reverse video.  The remainder of the command line (what
  107.    you enter) will appear in normal video.
  108.  
  109.    And, for example:
  110.  
  111.    prompt $e[7m MSDOS $n$g$e[m
  112.  
  113.    might cause the prompt " MSDOS A>" to appear in reverse
  114.    video.  The leading blank makes the display more  clear
  115.    on  some monitors.  [The  "$n"  above  will    cause  the
  116.    letter  of the currently logged drive to appear in  the
  117.    command line.]  Remember ==>  this  trick will NOT work
  118.    if  you  are not using ANSI.SYS in a normal fashion    on
  119.    the COMMAND.COM disk  you  initially  boot  the  system
  120.    with.
  121.  
  122.    Some  users will discover  that  by    playing  with  the
  123.    sequences following "$e" above, they may  acheive  some
  124.    interesting results on color monitors.  The "$e" allows
  125.    usage of an "escape sequence"  and  is beyond the scope
  126.    of this article.  {Hint: "[m" = "[0m"}
  127.  
  128.    ==> Advanced Level Usage
  129.  
  130.    One    of  the  most  interesting  uses  of the  "prompt"
  131.    command was recently discussed  by  Harold M. Bauman in
  132.    his    Heath/Zenith  column  in  the  June  '85 issue  of
  133.    "COMPUTER SHOPPER". His techniques apply to almost  all
  134.    IBM compatibles and    are  explained    in  less technical
  135.    fashion below.  The "prompt"  command  can  be  used to
  136.    redefine keys either from the DOS command level or with
  137.    use of a .BAT  file.   The keys can either be redefined
  138.    one-at-a-time  or in a sequence of commands.  So  =YOU=
  139.    can    determine  the    definition  of    some  keys  to    be
  140.    anything from a single keystroke to numeric formulas to
  141.    complex strings of data.  [Harold Bauman's column is  a
  142.    little  more comprehensive in explaining  some  of  the
  143.    other  possibilities   of   this   technique  than  the
  144.    description below.]
  145.  
  146.    This means that in  many  applications, you do not need
  147.    commercial  or public domain software to redefine keys.
  148.    You can do it yourself.  But...  it    will not work with
  149.    all applications programs and  it may interfere with or
  150.    override  the preset definitions of some software.    It
  151.    may be of use in adding additional keyboard definitions
  152.    to  programs  which    have  only  a  limited    number    of
  153.    specially defined  keys.   (For  example, SYMPHONY only
  154.    uses  about    23  of    the possible 40 function  [F]  key
  155.    combinations.)
  156.  
  157.    The syntax of the  basic  redefinition  command  is    as
  158.    follows:
  159.  
  160.    prompt $e[0;n;"def";13p    1 - basic setup, needed in
  161.    ^^^^^^^^^^^                most definitions
  162.    11111111111 ^        2 - numeric value of key
  163.            2 ^^^^^            to be redefined (see
  164.          33333 ^^^        appendix B)
  165.                444    3 - alphanumeric string
  166.    prompt                assigned to the key
  167.    ^^^^^^                (quotes required)
  168.    555555            4 - places a <RETURN> at
  169.                     string; deletion of 13
  170.                     ends string w/o <RETURN>
  171.                 5 - see note 4 in APPENDIX A
  172.  
  173.    Here is an example of what can be done from the command
  174.    level:
  175.  
  176.    prompt $e[0;68;"DIR /p";13p
  177.    prompt
  178.                redefines  F10  to give a paged
  179.                DIR command of logged drive and
  180.                restores basic MSDOS prompt
  181.  
  182.    A .BAT  file  can be created to define keys more simply
  183.    and without having to  worry  about    getting the syntax
  184.    exactly right for each definition.  The following is an
  185.    example you might call DEFINKEY.BAT:
  186.  
  187.    prompt $e[0;%1;%2;%3;13p
  188.    prompt
  189.  
  190.    Then, the command sequence
  191.  
  192.    DEFINKEY 68 DIR /p<RETURN>
  193.  
  194.    will acheive the same  results  as the more complicated
  195.    example above.  This method    can allow strings of up to
  196.    8 words (alphanumeric combinations separated by spaces)
  197.    to be defined.  [The  %1 above is used to allow for the
  198.    redefined key  to  be specified.  %2 and %3 are for the
  199.    two "words" in the string.]
  200.  
  201.    Commands can also be  added    to an AUTOEXEC.BAT file to
  202.    define  several keys on start-up.  In such  situations,
  203.    the full syntax "prompt"  commands  should  be  used to
  204.    avoid confusion and    to  maintain  consistency  on each
  205.    startup.
  206.  
  207.    This undocumented usage of the DOS "prompt" command has
  208.    many possibilities limited only by a users' imagination
  209.    or willingness to experiment.   There  is  more to this
  210.    "trick"   than  an  alternative  to    key   redefinition
  211.    software.  It is a demonstration of    the  real power of
  212.    Microsoft DOS.
  213.  
  214.  
  215.    APPENDIX A
  216.    ----------
  217.    when redefining keys with "prompt":
  218.  
  219.    1>  the  new  definitions  will  NOT  be recognized    by
  220.    programs  or  applications  which  bypass  DOS  to  get
  221.    keyboard information.  BASIC is an example.
  222.  
  223.    2> use of the  "prompt"  command  without  operators or
  224.    arguments  will  NOT  restore  the  original   keyboard
  225.    definitions.   The  system  must  be  re-booted   (i.e.
  226.    Cntl-Alt-Del).
  227.  
  228.    3> if keys are redefined with "prompt" in a .BAT  file,
  229.    the ECHO command must be =ON= or the redefinitions will
  230.    not be recognized.
  231.  
  232.    4> after a sequence of redefinitions with "prompt", the
  233.    MSDOS prompt itself    must be redefined (as shown in the
  234.    Basic section above) or the    "prompt"  command (without
  235.    operators) must be entered.    Otherwise there will be no
  236.    prompt  at  the MSDOS command level and the cursor will
  237.    blink at the far left column.
  238.  
  239.  
  240.    APPENDIX B
  241.    ----------
  242.    Key values used for redefining keys with "prompt"
  243.  
  244.     F1 = 59 F2 = 60 F3 = 61 F4 = 62 F5    = 63
  245.     F6 = 64 F7 = 65 F8 = 66 F9 = 67 F10 = 68
  246.  
  247.     Shift-F1 = 84 Shift-F2 = 85 Shift-F3 = 86 Shift-F4 = 87
  248.     Shift-F5 = 88 Shift-F6 = 89 Shift-F7 = 90 Shift-F8 = 91
  249.     Shift-F9 = 92 Shift-F10 = 93
  250.  
  251.     Ctrl-F1 = 94 Ctrl-F2 = 95 Ctrl-F3 = 96 Ctrl-F4 = 97
  252.     Ctrl-F5 = 98 Ctrl-F6 = 99 Ctrl-F7 = 100 Ctrl-F8 = 101
  253.     Ctrl-F9 = 102 Ctrl-F10 = 103
  254.  
  255.     Alt-F1 = 104 Alt-F2 = 105 Alt-F3 = 106 Alt-F4 = 107
  256.     Alt-F5 = 108 Alt-F6 = 109 Alt-F7 = 110 Alt-F8 = 111
  257.     Alt-F9 = 112 Alt-F10 =113
  258.  
  259.     Alt-1 = 120 Alt-2 = 121 Alt-3 = 122 Alt-4 = 123
  260.     Alt-5 = 124 Alt-6 = 125 Alt-7 = 126 Alt-8 = 127
  261.     Alt-9 = 128 Alt-0 = 129 Alt-- = 130 Alt-= = 131
  262.  
  263.     Alt-A = 30 Alt-B = 48 Alt-C = 46 Alt-D = 32 Alt-E = 18
  264.     Alt-F = 33 Alt-G = 34 Alt-H = 35 Alt-I = 23 Alt-J = 36
  265.     Alt-K = 37 Alt-L = 38 Alt-M = 50 Alt-N = 49 Alt-O = 24
  266.     Alt-P = 25 Alt-Q = 16 Alt-R = 19 Alt-S = 31 Alt-T = 20
  267.     Alt-U = 22 Alt-V = 47 Alt-W = 17 Alt-X = 45 Alt-Y = 21
  268.     Alt-Z = 44
  269.  
  270. -end-
  271.  
  272.  = 16 Alt-R