Skip to content

Instantly share code, notes, and snippets.

@tohagan
Last active June 13, 2016 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tohagan/d2e50a6c47f9fe8b2a2d6ceab1ad0ba7 to your computer and use it in GitHub Desktop.
Save tohagan/d2e50a6c47f9fe8b2a2d6ceab1ad0ba7 to your computer and use it in GitHub Desktop.
Usage wcd "<windows path>" - Copy paste a paths from Explorer into Windows bash to cd to that folder.
# Add to your ~/.profile or ~/.bashrc file ...
# Use in Windows bash to cd to a Windows directory path containing backslashes.
wcdfn() {
if [ -z "$1" ]
then
echo "wcd <windows-path>" 2>&1;
else
#cd `echo "/$1" | sed -e 's,\\\\,/,g' -e 's/://' `
cd `cygpath -u "$1"`
fi
}
alias wcd=wcdfn
@tohagan
Copy link
Author

tohagan commented Apr 29, 2016

 $ wcd "D:\MyProjects\proj1\src"

 $ pwd
  /d/MyProjects/proj1/src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment