Skip to content

Instantly share code, notes, and snippets.

@kranthilakum
Created June 13, 2013 12:00
Show Gist options
  • Save kranthilakum/5773142 to your computer and use it in GitHub Desktop.
Save kranthilakum/5773142 to your computer and use it in GitHub Desktop.
Open windows explorer anywhere. To open current working directory use < start . > or < explorer . > in cygwin
# !/bin/bash
# author: Robert Mark Bram
# link: http://robertmarkbramprogrammer.blogspot.se/2007/06/cygwin-bash-script-open-windows.html
usage ()
{
echo "Open Windows Explorer"
echo "Usage: $0 [-help] [path]"
echo " [path]: folder at which to open Windows Explorer, will"
echo " default to current dir if not supplied."
echo " [-help] Display help (this message)."
}
location=.
case "$1" in
"" ) location=.;;
"-help" ) usage; exit 0;;
* ) location="${1}";;
esac
if [ -e "$location" ]
then
WIN_PATH=`cygpath -w -a "${location}"`
cmd /C start "" "$WIN_PATH"
else
echo ${location} does not exist!
exit 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment