HISTORY - Manage the history list
Purpose: Display, add to, clear, or read the history list.
Format: HISTORY [/A command /F /P /R filename ]
command : A command to be added to the history list.
filename : The name of a file containing entries to be added
to the history list.
/A(dd) /P(ause)
/F(ree) /R(ead)
See also: DIRHISTORY and LOG.
Usage
CMD.EXE keeps a list of the commands you have entered on the command
line. See Command History and Recall for information on command recall,
which allows you to use the history list to repeat or edit commands you
have previously executed.
The HISTORY command lets you view and manipulate the command history list
directly. If no parameters are entered, HISTORY will display the current
command history list:
[c:\] history
With the options explained below, you can clear the list, add new
commands to the list without executing them, save the list in a file, or
read a new list from a file.
The number of commands saved in the history list depends on the length of
each command line. The history list size can be specified at startup
from 256 to 32767 characters (see the History directive). The default
size is 1024 characters.
Your history list can be stored either locally (a separate history list
for each copy of CMD.EXE) or globally (all copies of CMD.EXE share the
same list). For full details see the discussion of local and global
history lists under Command History and Recall.
You can use the HISTORY command as an aid in writing batch files by
redirecting the HISTORY output to a file and then editing the file
appropriately. However, it may be easier to use the LOG /H command for
this purpose.
You can disable the history list or specify a minimum command-line length
to save with on the Command Line 1 page of the OPTION dialogs, or with
the HistMin directive in the .INI file.
You can save the history list by redirecting the output of HISTORY to a
file. This example saves the command history to a file called HISTFILE
and reads it back again immediately. If you leave out the HISTORY /F
command on the second line, the contents of the file will be appended to
the current history list instead of replacing it:
[c:\] history > histfile
[c:\] history /f
[c:\] history /r histfile
If you need to save your history at the end of each day's work, you might
use commands like this in your AUTOEXEC.BAT or other startup file:
if exist c:\histfile history /r c:\histfile
alias shut*down `history > c:\histfile`
This restores the previous history list if it exists, then defines an
alias which will allow you to save the history before shutting off the
system.
Options
/A: (Add) Add a command to the history list. This performs the
same function as the Ctrl-K key at the command line (see
Command History and Recall).
/F: (Free) Erase all entries in the command history list.
/P: (Prompt) Wait for a key after displaying each page of the
list. Your options at the prompt are explained in detail
under Page and File Prompts.
/R: (Read) Read the command history from the specified file and
append it to the history list currently held in memory. Each
line in the file must fit within the command-line length
limit).
If you are creating a HISTORY /R file by hand, and need to
create an entry that spans multiple lines in the file, you can
do so by terminating each line, except the last, with an
escape character. However, you cannot use this method to
exceed the command-line length limit.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs