DOSKEY Macro Codes and Examples

DOSKEY Macro Codes

$1..$9 -- Command line parameters

$* -- This may be used in place of all parameters. For example: DOSKEY DDIR=dir /B $* would let you use DDIR /S /A:A /O:N as well as DDIR /P

$T or $t -- is a separator that Terminates one command before starting another. You can have as many commands as will fit on the DOS 127 character command line.

$g or $G -- DOSKEY's code for ">"

$g$g or $G$G -- DOSKEY's code for ">>"

$B or $b -- DOSKEY's code for "|"

$l or $L -- DOSKEY's code for "<"

DOSKEY EXAMPLE MACROS

DOSKEY p=prompt $$P$$G -- Reinstalls the DOS prompt "C:\path>". Note the use of "$$G" to tell DOSKEY that you want $P$G to appear on the command line.

DOSKEY app=TYPE $1 $G$G $2 -- Appends one file to a second file. This works only for straight ASCII text files.

DOSKEY UnMac=DOSKEY $1= -- This will remove a single macro given as $1.

DOSKEY Hide=D:\DOS\Attrib +H $* -- This macro sets the attribute from a group of files.

DOSKEY UNhide=D:\DOS\Attrib -H $* -- This macro clears the attribute from a group of files.

DOSKEY OK=echo ^[[0;66;"EXIT";13p^[[0;67;"LOADFA";13p^[[0;68;"STS";13p$tcls

DOSKEY KK=echo ^[[0;65;0;65p^[[0;66;0;66p^[[0;67;0;67p^[[0;68;0;68p$tcls --

These two macros set and reset the function keys F8, F9, and F10 which use the NANSI.SYS screen driver to define the keys. You'll have to create the macro with a text editor such as VDE or TED2 or Qedit that lets you create the ESC character. However, when you use the command DOSKEY /M, the ESC character will appear as ^[.

DOSKEY DDR=del $1\*.* $T rd $1 -- This deletes all files from a directory, then removes the directory.

DOSKEY ND=MD $1 $t CD $1 -- This creates a new directory and then changes to it.

DOSKEY TYPE=Type $1 $B MORE -- Requires the MORE command from DOS 5.0. Note that the Macro TYPE command will take precedence over the DOS TYPE command.

DOSKEY THAD=show 8003736114 -- This macro uses the SHOW (large font viewer) to display the number for Thaddeus Computing, Inc.