-
Create a file called
alias.cmdin the user folder (i.e.%USERPROFILE\alias.cmd) or where ever you feel suited. This will be like your~/.bash_aliason your linux machine. -
Add your alias into the script using the
doskeycommand
@echo off
:: Commands
DOSKEY ls=dir /B $*
DOSKEY ll=dir /a $*
DOSKEY git-secret=wsl git-secret $*
DOSKEY gs=wsl git-secret $*Note: $* is used to allow taking arguments
- Register it to be applied automatically whenever
cmd.exeis executed
reg add "HKCU\Software\Microsoft\Command Processor" /v AutoRun /t REG_EXPAND_SZ /d "%"USERPROFILE"%\alias.cmd" /f- Restart cmd for the changes to take effect To unregister:
reg delete "HKCU\Software\Microsoft\Command Processor" /v AutoRun
However this will remove all added scripts.