bash-like `cd` behavior in Windows command interpreter
@echo off | |
:: Adds support for | |
:: `cd` change to user profile directory | |
:: `cd -` change to previous directory | |
doskey cd=^ | |
set PD="%%CD%%" ^& ^ | |
if [$*]==[] ( ^ | |
cd /d %%userprofile%% ^ | |
) else ( if [$*]==[-] ( ^ | |
cd %%PD%% ^ | |
) else ( ^ | |
cd ^"$*^" ^ | |
) ) ^ | |
; | |
set PD="%CD%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment