Lloyd Robert Borrett

Follow Lloyd on Twitter Friend Lloyd on Facebook Connect with Lloyd on LinkedIn Follow Lloyd on Pinterest

Changing Prompts

by Lloyd Borrett
Today's Computers, Wizard's Notebook, July 1985

  Wizard's Notebook

Wizard's Notebook

PROMPT Command

For those who are forever becoming lost out on a limb of the DOS tree-like directory structure, help is available. You'll find the answer in the PC DOS reference manual in the form of the PROMPT command. Here is a brief run-down on the use of the PROMPT command.

PROMPT lets the user determine exactly how the operating system prompt appears on the screen. PC DOS allows users to put text, escape sequences, the current disk and directory name, various special characters and the system time into the prompt, in any order.

The syntax of the command is "PROMPT <prompt-text>", and if no prompt text is supplied, the prompt returns to the default of the disk name followed by a "greater than" sign (">"). In the prompt-text, normal text comes out as written, and all special characters are entered using a dollar sign ($) followed by a single character as follows:

$ for the dollar sign character.
t for the current time.
d for the current date.
p for the current directory and drive.
v for the DOS version number.
n for the default drive.
g for the ">" character.
l for the " <" character.
b for the "|" character.
q for the "=" character.
h for a backspace and erasure of the previous character.
e for an escape character.
- for a carriage return line feed sequence.

My favorite prompt is to display the disk and directory name followed by a ">". The prompt command to do it is:


Thus my position within the directory structure is always displayed.

Note that it is possible to send out screen control characters if the ANSI.SYS device driver is loaded. To do this include the line "DEVICE = ANSI.SYS" in a CONFIG.SYS file on your system disk, and make sure the file ANSI.SYS is in the initial working directory.

My favorite prompt could be displayed in reverse video using the prompt command:

PROMPT $e[7m$p$g$e[m.

Notice that the escape sequence is used at the end to turn reverse video off; otherwise, everything you type at the prompt would also be in reverse video.

Rename Directories

DOS allows users to organise their files by pigeon-holing everything away in nested subdirectories, but it doesn't provide a convenient way to rename directories.

To rename a directory, most users create a new one with the new name, copy all the files into it from the old one, and remove the old one or take advantage of special utilities such as the Norton Utilities. Advanced DOS users can use DEBUG to manipulate the disk directory and revise any filename.

However, DOS 3.0 users can change any subdirectory name simply by going into BASIC 3.0 and using its NAME command. For instance, to change the name of the DOS subdirectory \SALT into \PEPPER, all a Basic 3.0 user need type is:


Both Basic 2.1 and 3.0 users can use a similar trick to move files from one directory without copying and erasing. Just enter:

NAME "\dir1\file.ext" AS "\dir2\ file.ext"

This is quite a neat trick. It seems that although Basic is updated to make use of the new features of each revision of DOS, most of the DOS commands are not.

Contrary to popular belief, you can easily obtain a list of DOS sub-directories. Most people use the command "DIR*.", and, assuming there are few files without extensions in the current directory, it works fine. To overcome this limitation use the command:


But this trick will not work across subdirectories and won't go more than a level deep. The two ways DOS provides to list all your subdirectories are:



CHKDSK/ V | FIND "Directory" | SORT | MORE

Make sure the proper combinations of TREE.COM, FIND.EXE, CHKDSK. COM, MORE.COM, and SORT.EXE are on your disk or PATHed to.

Wizard's Notebook is a regular feature in Today's Computers in which Lloyd Borrett will pass on tips for PC users. Naturally, you are invited to contribute tips on software, hardware and documentation. Address letters to Wizard's Notebook, Today's Computers, 392 Little Collins Street, Melbourne, 3000. Please include your telephone number, which will not be published, so we may call to verify letters.

Last modified: Saturday, 15 October 2011


home | about | weird mob | computing | interests | insight
Copyright © 1995-2021 Lloyd Borrett. All rights reserved.  ::  www.borrett.id.au
mob 0418 170 044  ::  tel +61 3 5904 9005  ::  email lloyd@borrett.id.au  ::  skype lloyd_borrett
twitter @borrett  ::  facebook lloyd.borrett  ::  linkedin lloydborrett