Skip to content

Instantly share code, notes, and snippets.

@mcgwiz

mcgwiz/profile.cmd

Last active Mar 31, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.