Tutorial by Examples

Using DOSKEY, we can create macros to simplify typing many commands in command prompt. Take a look at the following example. DOSKEY macro=echo Hello World Now if you type macro in the command prompt, it would return Hello World.
Unfortunately, DOSKEY macro doesn't support comment, but there's a workaround. ;= Comment ;= Comment ;= Remember to end your comment with ;= ;=
There are 3 usages of the $ character in a DOSKEY macro. Command separator $T is the equivalent of & in a batch script. One can join commands together like so. DOSKEY test=echo hello $T echo world Command-line arguments Like bash(not batch), we use $ to indicate command-line argument....
DOSKEY macros don't work in a batch script. However, we can use a little workaround. set DOSKEYMacro=echo Hello World %DOSKEYMacro% This script can simulate the macro function. One can also use ampersands(&) to join commands, like $T in DOSKEY. If you want a relatively large "macro&qu...

Page 1 of 1