Contents of the HISTORY.DOC file
HISTORY PC Version 6.1
HISTORY is a program for PC-DOS 2.0 and later (there is also
a version for the DEC Rainbow) which allows the user to recall,
edit, and reissue previously-typed DOS commands. If a mistake is
made on the command currently being entered but is not noticed
until after several more characters have been typed, the mistake
may be fixed without deleting the intervening characters.
Commands are saved in a FIFO buffer. By default the buffer
is 512 bytes long; the number of commands that can be saved in
the buffer depends on their length. When the buffer becomes
full, one or more of the oldest commands are evicted to make room
for a new command. If a new command is identical to the
immediately preceding command, it is not duplicated in the
The user steps back and forth through old commands using the
up- and down-arrow keys. Up-arrow recalls the most recent
command, another up-arrow the second most recent, and so forth.
Down-arrow moves forward in the buffer. Both movements are
circular -- when up-arrow reaches the oldest command another up-
arrow will return to the current command (the DOS prompt). An
initial down-arrow will move to the oldest command.
The left- and right-arrow keys may be used to move within a
line. Home moves to the beginning of the line, while End moves
back to the end. The Backspace key deletes the character to the
left of the cursor and the Del key deletes the character under
the cursor. Normal characters are inserted into the line. Other
editing commands are summarized below.
A line may be recalled by content by typing Alt-S; the user
is then prompted for an anchored search string. The history list
is searched backwards for the line beginning with the specified
string. To search for the next-most recent occurrence of the
string, the user merely hits Alt-F. As a shorthand for Alt-S,
Alt-X prompts for a single-character search string without a
carriage return; the selected command is automatically executed.
The string seleted by Alt-S or Alt-X is remembered between
HISTORY invocations. Subsequent uses of Alt-F use this string
until another is chosen. All searches wrap circularly.
Multiple DOS commands may be entered on one line by
separating them with a semi-colon. The commands will be sent one
at a time to DOS. A semicolon as the last character on the line
will be sent along (hello, MicroSoft). To enter a semicolon mid-
command, type two (one will be sent).
Shift-Tab replaces everything to the right of the cursor
with the last argument of the previous command in the buffer.
This is useful for applying successive commands to the same
argument. Successive Shift-Tab's move back through the buffer.
Other function key actions are described under "Function Key
A set of "immortal" commands may be loaded from a file by
specifying the file name as an argument when HISTORY is loaded or
by loading the file interactively with Alt-L. The commands are
immortal in that they are not deleted to make room for new
commands. The immortal commands remain at the top (oldest) part
of the buffer and thus are immediately accessible via the
down-arrow key. They may be searched for and otherwise treated
as any other commands.
The buffer is cleared before the file is loaded. There must
be at least 64 bytes left after loading for normal mortal
commands; HISTORY stops loading when this limit is reached. You
may increase the buffer size from its default of 512 bytes when
HISTORY is loaded (see below).
Commands may be given an alias via the syntax
Whenever the alias is typed at the start of the line, its
replacement is inserted in its place and the resulting command
executed. For example given the aliases
:dw dir /w
in the command buffer, typing
is equivalent to typing
is equivalent to
Alias substitution is only done on the first word of a
command; multiple commands separated by semicolons will, however,
have alias substitution applied to each command. Substitution is
reapplied until no more aliases are translated, so one alias may
be defined in terms of another. If the replacement begins with
the same name as the alias, however, replacement stops; thus
:dir dir /w
will not loop recursively but will give the desired result. To
prevent alias substitution in commands, precede the command verb
with a colon.
Aliases are usually loaded from a file of immortal commands
but may also be established interactively. Non-immortal aliases
eventually age and die, however.
If multiple definitions of the same alias exist, the first
one encountered searching from most recent to oldest is used. If
an alias is defined with no replacement string, e.g.
then this cancels the effect of older definitions of the same
alias; in this case dir is no longer an alias for something else.
A special case of an alias is the Hot Key. A command may be
aliased as a function key. If the function key is then pressed
at the beginning of the line, the command is executed without
waiting for a carriage return. The alias must be a 2-character
hex code from the following table:
Key Code Key Code Key Code Key Code
F1 3B Alt-F1 68 Alt-A 1E Alt-Hyphen 82
F2 3C Alt-F2 69 Alt-B 30
F3 3D Alt-F3 6A Alt-C 2E
F4 3E Alt-F4 6B Alt-E 12
F5 3F Alt-F5 6C Alt-G 22
F6 40 Alt-F6 6D Alt-I 17
F7 41 Alt-F7 6E Alt-J 24
F8 42 Alt-F8 6F Alt-K 25
F9 43 Alt-F9 70 Alt-M 32
F10 44 Alt-F10 71 Alt-N 31
Sh-F1 54 Alt-1 78 Alt-P 19
Sh-F2 55 Alt-2 79 Alt-Q 10
Sh-F3 56 Alt-3 7A Alt-R 13
Sh-F4 57 Alt-4 7B Alt-T 14
Sh-F5 58 Alt-5 7C Alt-U 16
Sh-F6 59 Alt-6 7D Alt-V 2F
Sh-F7 5A Alt-7 7E Alt-W 11
Sh-F8 5B Alt-8 7F Alt-Y 15
Sh-F9 5C Alt-9 80 Alt-Z 2C
Sh-F10 5D Alt-0 81 Alt-= 83
These codes are cryptic, but a more user-friendly scheme would
consume precious dedicated memory. You may put a comment at the
end of the alias definition by preceding the comment by zero or
more spaces followed by two pound signs (##).
As an example, the following alias in the command buffer
:44 dir ## F10
would cause the dir command to be executed when F10 was pressed.
Changing the Buffer Size
The default command buffer size of 512 bytes can be changed
when HISTORY is loaded by specifying as the first argument a dash
followed by the buffer size (no intervening space), e.g.
The buffer size should be at least 64. Big buffers allow more
immortal commands and a bigger window of mortal commands, but
consume more memory and produce a more verbose buffer listing.
HISTORY is enabled by executing HISTORY.EXE once per boot,
typically from AUTOEXEC.BAT. It requires about 8K of dedicated
The HISTORY command may contain a buffer size argument
and/or an immortal command file argument:
history -size file
Both arguments are optional. See the discussion above for
HISTORY works by trapping DOS function 0AH. Since programs
other than COMMAND.COM also use function 0AH, HISTORY must
distinguish COMMAND.COM from the crowd. It does this by
remembering the address of the very first program to call it
after it's been loaded; to insure that COMMAND.COM is the first
caller, make HISTORY the last command in AUTOEXEC.BAT or invoke
Function Key Summary
Up-arrow or Move back through commands.
Down-arrow or Move forward through commands.
Shift-Tab Replace everything right of the cursor with
the last argument of the previous command.
Left-arrow Move the cursor left one character.
Right-arrow Move the cursor right one character.
Home Move the cursor to the beginning of line.
End Move the cursor to the end of the line.
Ctrl-left Move the cursor left one word.
Ctrl-right Move the cursor right one word.
Backspace Delete the character before the cursor.
Del Delete the character under the cursor.
Ctrl-PgUp or Delete from start of previous word to cursor.
Ctrl-PgDn or Delete from cursor to start of next word.
Ctrl-Home Delete from the beginning of the line to the
Ctrl-End Delete from the cursor to the end of the
Ins Toggle insert/overstrike mode (starts each
time in insert mode).
Return Execute the command (regardless of cursor
Alt-S Select and find search string.
Shift-Alt-S Select and find search string and execute.
Alt-F Find next occurrence of string (remembered
Shift-Alt-F Find search string and execute.
Alt-X Select and find one-character search string
Alt-D Same as typing "EXIT"; useful for leaving
Alt-H Lists the contents of the history buffer,
oldest to most recent.
Shift-Alt-H Lists the contents of the history buffer,
most recent to oldest.
Alt-O Disables HISTORY; commands are parsed via
normal DOS code until Control-Z followed by
Return is typed. HISTORY remains resident
in memory and the command buffer remains
intact. See bug list below.
Alt-L Promts for the name of a file of immortal
commands and loads that file.
; If not the last character on the line, splits
DOS commands. They are handed one at a time
to COMMAND.COM. If last on the line, it is
sent along as part of the command. To send a
semicolon mid-command, type two semicolons.
^C, ^X or ESC Delete the line being typed/edited.
When printing a file using the standard DOS print spooler
PRINT.COM, lines are sent to the printer only when awaiting DOS
input; since HISTORY bypasses DOS input when awaiting command
input, the printer will stop until a command is run.
Similarly, Control-P (printer toggle) will not be recognized
in HISTORY. The solution to both problems is to use Alt-O to
disable HISTORY long enough for the file to print or to type
Control-P (once toggled on you may turn HISTORY back on; printing
will take place in this case).
To reenable HISTORY, type Control-Z followed by Return.
If HISTORY has been disabled via Alt-O and ^C is typed at
the DOS command prompt, HISTORY can not be reenabled.
A bug which caused the system to hang was fixed.
HISTORY properly handles long lines which wrap around two
Searches are now caseless.
The amount of dedicated memory required has been reduced.
A bug associated with ^X was fixed.
Immortal commands added. Labeled commands added.
If a command is identical to the immediately preceding
command, the second is not saved in the history buffer.
Fixed a bug which caused immortal commands to be mortal.
Fixed a bug which ocurred when backspacing over the response
to a prompt.
Added delete-word commands.
Made ^C behave like ^X.
Replaced F10, F9, etc., with Alt keys. Added Shift-Alt-F
Labeled commands replaced with aliasing.
Alias substitution applied to semicolon-separated commands.
Added Hot Keys. Added Shift-Alt-H (lists command buffer in
reverse order). Added alias cancel capability. ^C cancels
command buffer list.
Translations of hot keys shown when executed.
Fixed a bug wherein a command was not saved in the buffer if
the command was a substring of the previous command.
Added optional setting of command buffer size when HISTORY
Made Escape behave like ^X. Notification when HISTORY
Made Shift-Tab non-destructive to the part of the command
line left of the cursor. Ctrl-End now clears commands spilling
onto a second line.
Ignore Num Lock state.
Fixed a bug where the file handle used to read the file of
immortal commands was not being closed and thus free after use.
Fixed a bug involving typing an unmapped function key at the
beginning of a non-empty line.
Fixed a bug where an alias was not being translated if
followed immediately by a semicolon.
Reports buffer size when loaded.
Copyright (c) 1985-89 by Bryan Higgins. All rights reserved,
except the right to copy for non-commercial use.
The author may be reached/rewarded at
1802 Channing Way
Berkeley, CA 94703
Please specify PC HISTORY version 6.1 when referring to this
One of the Kramden Utilities.