Configure Cygwin inside total commander

September 13, 2006 

Problem. 
In total commander, I often want to open a cygwin shell window to
put the selected directory as the current one.  
However, when a cygwin window is opened, the current directory always 
stick to the HOME, which is for me, "d:\cygwin\home\Yijun Yu". Then to
access a file in the visible directory of Total commander, I have to
issue a "chdir" to something like 
"/cygdrive/c/path/to/commander/directory". 
How annoying! Then how to work around this problem?

Solution.
It is a combination of small tricks. 
1. Create a shortcut button on the commander toolbar
  Right click at toolbar, choose "Change..."
  Append a command, fill in the following information:
  
2. Edit the start script of cygwin, namely D:\cygwin\cygwin.bat:
 
@echo off
echo cd "%*" > "D:\cygwin\home\Yijun Yu\.cdpath"
D:
chdir D:\cygwin\bin
bash --login -i

3. Create two scripts in your home directory 
   (e.g. "D:\cygwin\home\Yijun Yu"):
.profile:
  . .bashrc
.bashrc:
  source .cdpath

That's it. When you open any directory in total commander, just
click the cygwin.ico button, you will launch a cygwin shell in
the proper place. Enjoy!