Are you sick of typing ls instead of dir by accident on a command prompt when you’re using Windows?
Are you sick of Windows telling you that the command you just tried is not recognized as an internal
or external command, operable program or batch file?
You don’t need to suffer anymore, because DOSKEY is here and it allows you to create your own aliases in Windows.
alias.cmd in %USERPROFILE% and add your aliases in said file, like so:@echo off
DOSKEY alias=notepad %USERPROFILE%/alias.cmd
DOSKEY ls=dir /W
DOSKEY ll=dir
DOSKEY ~=cd %USERPROFILE%
DOSKEY touch=copy nul $* > nul
DOSKEY clear=cls
DOSKEY history=DOSKEY /h
DOSKEY g=git $*
DOSKEY d=docker $*
DOSKEY k=kubectl $*
NOTE: $* means every argument after the alias. Taking k from the example above, k get pods would be
transformed into kubectl get pods.
add-autorun-alias.reg and add the following content in the file:Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="%USERPROFILE%\\alias.cmd"
The above will cause your alias.cmd to run automatically every time command prompt starts.