7

I've tried using QuickOpener with the command:

C:\cygwin\bin\mintty.exe -e cd `cygpath "${currentFolder}"`

but it just opens a window saying: cd: No such file or directory.

MikeFHay
  • 2,754

3 Answers3

13

mintty can't directly call cd because that's a builtin command of the respective shell. What you really want is to start a shell in the correct directory.

I don't know about NetBeans or QuickOpener, but provided currentFolder contains an absolute Windows path, the following should work:

C:\cygwin\bin\mintty /bin/sh -lc 'cd "$(cygpath "$currentFolder")"; exec bash'

This runs a proper login shell that changes directory and then replaces itself with bash.

peth
  • 10,400
2

This is not quite what you asked for, but Cygwin comes with chere[1], which sets up a context menu entry in Windows Explorer.

This may be a decent substitute for what you seek, and you might be able to investigate the mechanism that chere relies upon and use it to fix your issue as well.

Rich Homolka
  • 32,350
0

I usually start Cygwin using the context menu with "Bash Prompt Here" (chere), and peth's answer didn't set up my environment the same as that. I looked at the registry and found that this is what "Bash Prompt Here" executes:

C:\cygwin64\bin\mintty.exe -e /bin/xhere /bin/bash.exe C:\path\to\your\directory

This works for me. It does require that chere is installed however.

Samuel
  • 131