The /macros and /history switches are useful for creating batch programs to save macros and commands.
For example, to store all current Doskey macros, type the following command:
doskey /macros > macinit
To then use the macros stored in MACINIT, type
To create a batch program named TMP.BAT that contains recently used commands,
type the following command:
doskey /history > tmp.bat
To define a macro with multiple commands, use $t to separate commands, as follows:
doskey tx=cd temp$tdir/w $*
In the preceding example, the TX macro changes the current directory to TEMP
and then displays a directory listing, using the wide display format. You can
use $* at the end of the macro to append other switches to the dir command when you run TX.
The following macro uses a batch parameter for a new directory name. The macro
first creates a new directory and then changes to it from the current
doskey mc=md $1$tcd $1
To use the preceding macro to create and change to a directory named BOOKS,
you type the following:
To create a Doskey macro for a specific program (in this case FTP.EXE) include
the /exename switch.
doskey /exename:ftp.exe go=open 126.96.36.199$tmget *.TXT c:\reports$bye
To use the preceding macro, start ftp. At the ftp prompt type go. Ftp will execute the open, mget, and bye commands.
More Information About Doskey