In my current project I use Kubernetes & docker tools on Windows 10 . To interact with Kubernetes and Docker environment typical we use
Docker command line tools , typing these commands all day is not fun , so I was searching for solution to create some sort of shorter alias for these commands.
This is easy on Linux with ‘alias‘ command put it into .bashrc , I was looking for similar solution on Windows . After googling around found that with .cmd file & some registry magic we can do the same.
Here are the steps .
value: AutoRunof type
%USERPROFILE%\cmdrc.cmd. This is required to persist setting across reboots.
cmdrc.cmdin my userprofile directory.You can access the user profile with %USERPROFILE% environment variable.
- Added following content in
DOSKEY cd=cd $1$Tdir
DOSKEY k8s=kubectl $*
DOSKEY dk=docker $*
With this setting in place any new command instance will have shorter alias set in cmdrc.cmd