Is it possible to assign a keyboard shortcut to a certain command in windows explorer?

7,770

Solution 1

Here's a hotkey for this: git_bash_here.ahk; allows you to "Git Bash Here" with Ctrl+Alt+T as in Gnome.

Just grab the script (change C:\Program Files\Git\git-bash.exe if your Git is installed elsewhere) and put it in your startup folder.

Solution 2

What I do is this:

  • I have a batch file titled d.bat (located in a folder on my path), the content being: start "" "%SYSTEMDRIVE%\Program Files\ConEmu\ConEmu64.exe ." (I use conemu as wrapper for git bash)
  • In windows explorer I then type Alt-D + D + <enter>. The first will select the title bar, the second will run the batch file on the current path.

Solution 3

Sometimes I use a keyboard with a special "context menu" key, which brings up the menu shown in the screenshot.

enter image description here

Pressing s after that selects and executes the "git bash here" entry.

So two keys instead of one, and you need this special key on your keyboard, but it comes for free.

Share:
7,770

Related videos on Youtube

chtenb
Author by

chtenb

Updated on September 18, 2022

Comments

  • chtenb
    chtenb over 1 year

    Here is my use case. Often I browse directories in windows explorer and find myself in need to open the gitbash at the current directory. Now git bash comes with a nice context menu entry

    enter image description here

    but since I do this so often, I would like to do this with a single keyboard shortcut. I imagine the command that would have to be executed would look like

    "C:\Program Files\Git\git-bash.exe" .
    

    Is it possible assign such a keybinding to get this done using whatever tool/technique?

  • chtenb
    chtenb about 8 years
    It seems I can only create folders in System32, even with admin rights.
  • LPChip
    LPChip about 8 years
    Create the file elsewhere, and copy it in.
  • chtenb
    chtenb about 8 years
    Done that. Now when typing gb . in the address bar, firefox starts with a google search to "gb ."... Is there a reboot required?
  • LPChip
    LPChip about 8 years
    You're typing it in the file explorer's address bar right? That shouldn't happen, unless it can't find the gb.cmd file
  • chtenb
    chtenb about 8 years
    Exactly so. In explorer I type Alt-D (for address bar focus) and then type gb .<enter>. Let me try a reboot.
  • chtenb
    chtenb about 8 years
    Reboot is not helping either.
  • LPChip
    LPChip about 8 years
    can you open a command prompt, and type echo %path% and tell me if C:\windows\system32 is mentioned somewhere in that string? This should be the case, but if not could cause for these symptoms
  • chtenb
    chtenb about 8 years
    Yes, it's there!
  • DavidPostill
    DavidPostill about 8 years
    Please read the question again carefully. Your answer does not answer the original question. "Is it possible to assign a keyboard shortcut to a certain command in windows explorer?"
  • dwettstein
    dwettstein about 8 years
    Hi DavidPostill. I know, that's what I wrote in the last sentence. At least, my answers helps the questioner to make the solution by LPChip work.
  • chtenb
    chtenb about 8 years
    @dwettstein normally, if you're gonna give a very different second answer, just do this in a new post
  • dwettstein
    dwettstein about 8 years
    You're right, sorry. I have copied it out.
  • chtenb
    chtenb over 7 years
    Used to be ctrl-alt-T for me in Gnome :) Anyway, great answer. So far I have been using the Menu-S shortcut. I just posted another answer to explain this. superuser.com/a/1152589/153117
  • Yibo Yang
    Yibo Yang over 7 years
    sorry I meant to type ctrl+alt+T; updated!