Skip to content

Instantly share code, notes, and snippets.

@pierreprinetti
Last active August 29, 2015 14:14
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 pierreprinetti/c83b62fbb2dca9e45fee to your computer and use it in GitHub Desktop.
Save pierreprinetti/c83b62fbb2dca9e45fee to your computer and use it in GitHub Desktop.
Cygwin "open with Window Explorer"
open () { if [ -z "$1" ]; then P="."; else P="$1"; fi; P=`cygpath -aw "$P"`; explorer "$P"; }
sublime () { if [ -z "$1" ]; then /cygdrive/c/Program\ Files/Sublime\ Text\ 3/subl.exe; else P=`cygpath -aw "$1"`; /cygdrive/c/Program\ Files/Sublime\ Text\ 3/subl.exe "$P"; fi; }
@pierreprinetti
Copy link
Author

If I ever happen to work on a Windows machine again, I will want this line added to my Cygwin's ~/.bashrc in order to launch the file manager with the specified path, or the system default application with the specified file.

This function fixes the weird behaviour of the explorer (most likely /cygwin/c/Windows/explorer.exe) command with POSIX paths as ~ ($HOME), . (current directory), ../ (parent directory).

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