You know that in Windows shift+ Right-click menu can be called out "open command Line Window" menu item, under the current path to execute some commands, very convenient. Is the effect that is made:
So how do you open Cygwin's command-line window in this way? The method is "outside the call", "Outbound call" is to add a right-click menu item through the registry, when the user clicks the menu item, call the corresponding program and pass in parameters, one of the important parameters is the current path. " Cygwin" is to detect the path parameter in the startup script, and if so, switch the work path to the path parameter.
Here's how to manually change the registry:
(1) Win + R, input regedit, enter, start Registry Editor, locate the Hkey_classes_root\directory\background\shell table entry
(2) Right-click on the "Shell" and new item, enter the name of the new item, such as "Open Cygwin window Here", this name will be displayed on the menu item. Right-click the new item, newly created item, and enter the new item named "Command", which must have the name "command", indicating the command to execute when the menu item is clicked. Double-click the (default) data item under command, and under Value data (V), enter the following:
"D:\Cygwin\bin\mintty.exe"-i/cygwin-terminal.ico/bin/env _t=%v/bin/bash-l
Explain what the above line means. "D:\Cygwin\bin\mintty.exe" is the location of mintty, note that depending on the Cygwin installation path differs. -I is used to specify the icon in the upper-left corner of the Mintty window,/bin/env _t=%v is used to set the value of the environment variable _t in the shell after the boot mintty, _t as the path parameter, where%v represents the path parameter passed by Windows. /bin/bash-l means to start the login shell
(3) If you only make the above settings, right-click to appear menu items. Now you want to set it to shift+ right-click before it appears. Find the new "Open Cygwin window Here", right-click-and-new string value, name enter "Extended", the value remains the default.
(4) Enter Cygwin, edit the ~/.bash_profile file, add the following at the tail:
_t=${_t//\\//} #将所有的 ' \ ' replaced with '/' if [[$_t = = ']]; Then _t=${home}ficd "${_t}"
(4) At this point, complete.
The following is a small tool context Menu Editor, simplify the above registry editing cumbersome operation, with administrator privileges to run the program, after the following settings, click "Set" to join the registry.
Note that the tool can set the small icon displayed to the left of the menu item, in effect creating a new "icon" under Hkey_classes_root\directory\background\shell\{newitemname} Data item and sets the value to be implemented for the icon path. This icon differs from the-I meaning in the Path text box.