Index | Syntax | Notes  



DOSKEY--Examples

The /MACROS and /HISTORY switches are useful for creating batch programs to  save macros and commands. For example, to create a batch program named MACINIT.BAT that includes all Doskey macros, type the following command: doskey /macros > macinit.bat To use the MACINIT.BAT file, edit it to include the DOSKEY command at the beginning of each macro line. 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 directory. doskey mc=md $1$tcd $1 To use the preceding macro to create and change to a directory named BOOKS, type the following: mc books To create a macro that uses batch parameters for moving a file or group of files, type the following command: doskey mv=copy $1 $2 $t del $1 To create a macro that causes the MEM command to pause after each screen, type the following command: doskey mem=mem $* /p
-Top- | Syntax | Notes