Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
987 views
in Technique[技术] by (71.8m points)

windows - CMD Command for "Git Bash Here"

In Windows I can run "Git Bash Here" in the current directory by opening right click menu.

I want to place gitbashhere.bat in default path for commands to have got easy access from standard cmd window.

The sh.exe --login -i command only opens git bash in sh.exe's directory instead of the current directory.

How do I check what command is bound to "Git Bash Here"?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

How do I check what command is bound to "Git Bash Here"?

  1. Open the Registry Editor using regedt32 or regedit.

  2. Menu "Edit" > "Find" > "Find what" and enter "git_shell"

  3. Examine the returned Registry entries.

  4. One will be:

    HKEY_CLASSES_ROOTDirectoryshellgit_shellcommand
    

    With the value:

    "C:WindowsSysWOW64cmd.exe" /c "pushd "%1" && "C:git_install_dirinsh.exe" --login -i"
    

    where git_install_dir is the directory where you have installed git.

    You can see it runs something similar to the following command:

    pushd "%1" && "C:git_install_dirinsh.exe" --login -i
    

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...