Create cmd.exe Aliases with doskey
doskey macros are cmd.exe's answer to bash aliases — short names for long commands, with $* for arguments.
01Command
$ doskey ll=dir /od $* ; doskey gs=git status $*02What it does
cmd.exe has no native alias command, but doskey macros fill the role, including parameter substitution: $1-$9 grab individual arguments and $* passes the whole tail. The catch everyone forgets: macros live only in the cmd.exe process that created them, so they vanish when the window closes. Persist them by saving with doskey /macros > macros.cmd and loading via /macrofile in an AutoRun registry value (HKCU\Software\Microsoft\Command Processor).
03Risk
04Undo
$ doskey ll= ; doskey gs=05Sources
- Doskey - Create macrosEvidence: Explains macro scoping: macros are per-console and can be made persistent through AutoRun registry entries or /macrofile.
- doskey (Windows Commands)Evidence: Documents doskey macro syntax, the $* parameter for trailing arguments, and /macrofile for loading saved macros.
Last verified: 2026-09-17 · Category: Developer
06Related solutions
One command that shows OS version, install date, boot time, memory, network adapters and installed hotfixes.
Built-in Windows command to compute MD5, SHA1 or SHA-256 hashes of any file.
Remove hidden, system and read-only flags from files or whole directory trees.