Update the PATH environment variable: From the Start menu, select Parameters > Control Panel > System. Select the Advanced tab and click Environment variables. Edit the PATH environment variable to add the Cygwin installation directory, for example c:\cygwin\bin; and click OK.
If you right-click on a . txt file and select "open with" you should be able to click "Browse" and go to C:\cygwin\bin\vim-nox.exe . Then you can click "Always use the selected program to open this kind of file".
When you install Cygwin (or if you’ve already installed it, download it again and start setup again to run an update), make sure that you select the chere
package under the "Shells" category.
After Cygwin is launched, open up a Cygwin terminal (as an administrator) and type the command: chere -i -t mintty -s bash
.
Now you should have "Bash Prompt Here" in the Windows right-click context menu.
(mintty is Cygwin's default terminal. If you don't choose it with the -t
option, your "Bash Prompt Here" will use the same terminal as the Windows Command Prompt, which prevents horizontal resizing.)
Here's what I use. It doesn't require chere
package or registry tinkering. Works on Windows 7.
Go to your "Send To" folder:
C:\Users\<your_user_name>\AppData\Roaming\Microsoft\Windows\SendTo
Create a shortcut named Bash Here
having this in the Target
field:
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico C:\cygwin\bin\bash.exe -l -c "cd \"$0\" ; exec bash"
In the Windows Explorer, you right-click on a folder & select Send To > Bash Here
.
And here's the opposite trick, opening a Windows Explorer in your current bash dir. Create this alias:
alias winx='/cygdrive/c/Windows/explorer.exe /e,\`cygpath -w .\`'
Note: the cygpath -w .
part above is enclosed in back-ticks.
Now just type winx
at the bash prompt, and a Win Explorer pops up there.
Note: If winx directs you to your documents folder, try
alias winx='/cygdrive/c/Windows/explorer.exe /e,`cygpath -w $PWD`'
From the cygwin terminal, run this command:
echo "cd your_path" >> ~/.bashrc
The .bashrc script is run when you open a new bash session. The code above with change to the your_path directory when you open a new cygwin session.
I made a .reg file that puts an "Open Cygwin Here" option in the right-click context menu. It depends on the Cygwin "chere" package, which you can install using apt-cyg if you didn't install it in the initial setup.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin_bash]
@="Open Cygwin Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin_bash\command]
@="C:\\cygwin\\bin\\mintty.exe -e /bin/xhere /bin/bash.exe"
For cygwin64 or installations without chere you can use the following command in a registry entry (assuming windows due to your path, also assuming cygwin installation directory is c:\cygwin64)
C:\cygwin64\bin\mintty.exe /bin/sh -lc 'cd "`cygpath "%V"`"; bash'
Works on Windows 7 and 8 Registry file available for download here: http://tomkay.me/blog/Cygwin64---Open-Here-18
Windows Registry Editor Version 5.00
; Open cygwin to folder
; http://tomkay.me - Tom Kay
[HKEY_CLASSES_ROOT\Folder\shell\open_cygwin]
@="Open Cygwin Here"
[HKEY_CLASSES_ROOT\Folder\shell\open_cygwin\command]
@="C:\\cygwin64\\bin\\mintty.exe /bin/sh -lc 'cd \"`cygpath \"%V\"`\"; bash'"
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_cygwin]
@="Open Cygwin Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_cygwin\command]
@="C:\\cygwin64\\bin\\mintty.exe /bin/sh -lc 'cd \"`cygpath \"%V\"`\"; bash'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With