Command Prompt Tips and Tricks

doskey.exe can be used to create macros for your custom command prompt. Just create a shortcut like this:

%SystemRoot%\system32\cmd.exe /k doskey /macrofile=”C:\tools\DosKeyMacroFile.txt”

DosKeyMacroFile.txt looks like this:

    n=notepad.exe $*
    s=pushd C:\scratch
    reboot=shutdown.exe -r -f -c “rebooting”
    dk=doskey /macros:all
    em=notepad “C:\tools\DosKeyMacroFile.txt”
    tools=pushd “C:\tools”

As you can see by the first line, you can use $* to specify that this command should receive it’s parameters from the command line. For example, if I want to edit test.cmd I just run “n test.cmd” from my command prompt.

Comments (0)