UTILITIES Ashok P. Nadkarni Vol. 9, No. 16 CMDEDIT Purpose: A TSR utility that supplies full editing features to the DOS interface; stacks commands and drive/directory pairs for recall; supports definable symbols and variables, and programmable function-key definitions and macros; provides optional autocompletion of commands and filenames; and enables changing drives and directories simultaneously. Format: CMDEDIT [/r] [/i] [/g] [/p X] [/d N1] [/m N2] [/b N3] [/s N4] [/f filename] Remarks: CMDEDIT can be entered at the DOS prompt, but is normally installed through the AUTOEXEC.BAT file. Its optional parameters at installation are: /r Auto recall mode (default off) /i Use insert mode (default overtype) /g Use silent mode (default beeps on error) /p Set the ignore macro character (default X is ;) /d DOS command stack buffer (default N1 is 512 bytes) /m Macro buffer size (default N2 is 512 bytes) /b Symbol buffer size (default N3 is 512 bytes) /s Directory Stack size (default N4 is 256 bytes) /f Initialization file to read at startup (default none) The CMDEDIT Ctrl-key editing actions are: ^F or Right-Arrow Cursor forward (character). ^B or Left-Arrow Cursor backward (character) ^Right-Arrow Cursor forward (word) ^LeftArrow Cursor backward (word) ^E or End Cursor to end of line. ^A or Home Cursor to start of line. ^D or Del Delete character at the cursor. ^H or Backspace Delete previous character ^W Delete word at right of cursor. ^L Deletes word at left of cursor. ^[ or ESC Erase entire command line. ^K Delete from cursor to end of line ^X Delete from cursor to start of line ^O Delete from cursor to EOL and execute line. ^G Erase entire line but keep in stack. ^^ (Ctrl-6) Execute line, but do not store or display (for passwords). INS Toggle insert/overtype modes. ^I or TAB Expand partial filename or directory name (adds\) if possible. ^J Replace variables with values. ^Q Place succeeding Ctrl-key on line as literal instead of command ^Z Put end-of-file marker on line. Commands given at the DOS prompt can be recalled from their buffer using the Up-Arrow (^U) or Dn-Arrow (^N) keys. Commands beginning with one or more user-typed letters can be recalled with ^R or ^V. In auto-recall mode, activated either with the /r switch or toggled by ^Y, a command stack search is made as each letter is typed in. The PUSHD d:\path command changes to and stacks a drive/directory pair. If at least one pair has been pushed into this buffer, entering PUSHD without parameters toggles between the current and stored pairs. POPD changes to and removes a stacked drive/directory pair, and the CHD d:\path command allows changing to a drive and directory simultaneously without affecting the stack. The DEFS symbol string command allows abbreviating a long command (the string) with one or more characters (the symbol). By using F1...F0 (for F10) and SF1...SF0 as the symbol values, the function and shifted function keys can be programmed to output strings on the command line. If these strings end in the @ character they will be executed, as well. To be expanded into its defined string, a symbol must be the first word on the command line. Before being passed to DOS or to an application the command line is scanned recursively, so one symbol can define another. Multi-line command macros are created by issuing the DEFM macroname command. Each line is terminated by hitting Enter, and the macro is terminated with the ENDM command. Macro command lines may contain parameters, which are designated by %n (n is a numeral from 1-9). Parameters are processed much as in DOS batch files (see article text). Macros support DOS batch file commands such as ECHO, PAUSE, IF, and FOR; see text for restrictions. Embedded spaces and tabs in macro command line arguments must be enclosed in pairs of quotes ("). Macros cannot be nested, and one macro can call another only from the last line before ENDM. Macros and symbols also support the use of string variables, which must be enclosed within % signs. See the article text for how these are processed. Macros and symbols may be deleted by name with the DELM and DELS commands, respectively, and the respective CMDEDIT buffers can be cleared and reset with the RSTHIST, RSTSYM, RSTDIR, and RSTMAC commands. Instructions for preparing an initialization file to load regularly-used macros and symbols via the /f parameter option are presented in a sidebar to the main article.