While at work, I want to use the CLI to be more productive on my Windows machine. What command, in Windows, would be a replacement for the
doskey com=a long command $*
$* expands to everything typed after
com. For example,
com Hi! would be expanded to
a long command Hi!
- This not limited to the
cmd.exeshell – it works with any program that uses a Win32 console window. (For example, for Python's interactive shell, use
doskey /exefile:python.exe ...)
To apply aliases automatically whenever
cmd.exe is launched:
Put them in a text file, in the form
com=very long example command cd=cd /d $*
I keep my aliases in
Create a batch script containing the
@echo off doskey /macrofile:"%AppData%\doskey.txt"
Of course, point
/macrofileto the location you have chosen in step 1.
A good name for this script is
In Registry, open key
HKEY_CURRENT_USER\Software\Microsoft\Command Processorand point the value
AutoRunto the script.
regedit, navigate to the given key.
- If a value named
AutoRundoes not exist, create it: right-click → New → String
- Modify the associated data to point to wherever your autorun script from #2 is located.
I assume you mean the "alias" command. Dos/NT command prompts support "alias" as a command with the following syntax:
See the wikipedia article for details: http://en.wikipedia.org/wiki/Alias_(command)