UpArrow | Recall the previous (or most recent) command, or the most recent command that matches a partial command line. |
DownArrow | Recall the next (or oldest) command, or the oldest command that matches a partial command line. |
F3 | Fill in the rest of the command line from the previous command, beginning at the current cursor position. |
Ctrl-D | Delete the currently displayed history list entry, erase the command line, and display the previous (matching) history list entry. |
Ctrl-E | Display the last entry in the history list. |
Ctrl-K | Save the current command line in the history list without executing it, and then clear the command line. |
Ctrl-Enter | Copy the current command line to the end of the history list even it has not been altered, then execute it. |
@ | As the first character in a line: Do not save the current line in the history list when it is executed, and do not store it in the CMDLINE environment variable. |
Use the UpArrow key repeatedly to scan back through the history list. When the desired command appears, press Enter to execute it again. After you have found a command, you can edit it before pressing Enter.
The history list is normally “circular”. If you move to the last command in the list and then press the down arrow one more time, you'll see the first command in the list. Similarly, if you move to the first command in the list and then press the up arrow one more time, you'll see the last command in the list. You can disable this feature and make command history recall stop at the beginning or end of the list by turning off the History Wrap selection on the Command Line 1 page of the OPTION dialogs, or setting Histwrap to No in the .INI file.
You can search the command history list to find a previous command quickly using command completion. Just enter the first few characters of the command you want to find and press UpArrow. You only need to enter enough characters to identify the command that you want to find. If you press the UpArrow key a second time, you will see the previous command that matches. The system will beep if there are no matching commands. The search process stops as soon as you type one of the editing keys, whether or not the line is changed. At that point, the line you're viewing becomes the new line to match if you press UpArrow again.
You can specify the size of the command history list with the OPTION command, or with the History directive in the .INI file. When the list is full, the oldest commands are discarded to make room for new ones. You can also use the HistMin directive in the .INI file to enable or disable history saves and to specify the shortest command line that will be saved.
You can prevent any command line from being saved in the history by beginning it with an at sign [@].
When you execute a command from the history, that command remains in the history list in its original position. The command is not copied to the end of the list (unless you modify it). If you want each command to be copied or moved to the end of the list when it is re- executed, set HistCopy or HistMove to Yes in CMD.INI. If you select either of these options, the list entry identified as “current” (the entry from which commands are retrieved when you press UpArrow) is also adjusted to refer to the end of the history list after each recalled command is executed.
The command history can be stored in either a “local” or “global” list.
With a local command history list, any changes made to the history will only affect the current copy of CMD.EXE. They will not be visible in other shells, or other sessions.
With a global command history list, all copies of CMD.EXE will share the same command history, and any changes made to the history in one copy will affect all other copies. Global lists are the default for CMD.EXE.
You can control the type of command history on the Startup page of the OPTION dialogs, with the LocalHistory directive in the .INI file, or with the /L and /LH options of the START command.
There is no fixed rule for deciding whether to use a local or global command history list. Depending on your work style, you may find it most convenient to use one type, or a mixture of types in different sessions or shells. We recommend that you start with the default setting, then modify it if you find a situation where the default is not convenient.
If you select a global history list for CMD.EXE you can share the history among all copies of CMD.EXE running in any session. When you close all CMD.EXE sessions, the memory for the global history list is released, and a new, empty history list is created the next time you start CMD.EXE.
If you want the history list to be retained in memory even when no command processor session is running, execute the SHRALIAS command, which loads a program to perform this service for the global command history, directory history, and alias lists.
Whenever you start a secondary shell which uses a local history list, it inherits a copy of the command history from the previous shell. However, any changes to the history made in the secondary shell will affect only that shell. If you want changes made in a secondary shell to affect the previous shell, use a global history list in both shells.