batch-file – Batch file macros – Macros In Batch Script

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", you may try a simple function or take a look at other function topics here.

if you want to reproduce, please indicate the source:
batch-file – Batch file macros – Macros In Batch Script - CodeDay