bash-like `cd` behavior in Windows command interpreter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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