Create command aliases in CMD with doskey
The forgotten bash-alias equivalent: define macros with $* argument passing, list them with /macros.
01Command
$ doskey ll=dir /b $*02What it does
doskey macros expand before execution, and $* passes everything typed after the alias, while $1–$9 pass individual arguments — e.g. doskey ga=git add $1. Macros exist only in the current CMD session, so persistent setups load them from a file via doskey /macrofile=macros.txt, typically from an AutoRun registry entry. They are not real executables, so batch files and other programs can't call them.
03Risk
04Undo
$ doskey ll=05Sources
- doskey | Microsoft LearnEvidence: Microsoft documents doskey macro definition syntax including $1-$9 and $* for arguments, /macros to list them, and that macros apply only to the current session.
- DOSKEY - Windows CMDEvidence: SS64 documents $* argument substitution, /macros, /history, and loading macros from a file with /macrofile.
Last verified: 2026-09-17 · Category: Developer
06Related solutions
Use Windows Package Manager to install, search, and upgrade thousands of applications from the community repository in one command.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
One command that shows OS version, install date, boot time, memory, network adapters and installed hotfixes.