Add Bash Context Menu in Windows 10

Windows 10 version 1607 "Anniversary Update" comes with a new feature called "Bash on Ubuntu". It provides the Linux command line shell "bash" for Windows via a native implementation which runs faster than a virtual machine with Linux installed. It allows running console Linux apps too. If you use it frequently, you might find it useful to have a special context menu command "Open Bash Here" that opens the Bash console in the desired folder with one click. Here is how you can add it.

In this article I assume that you have Bash on Ubuntu installed and configured in Windows 10. If not, ensure that you are running Windows 10 version 1607 and first install Bash. See these articles for reference:

Once configured, you can apply a Registry tweak as mentioned below.

To add Bash Context Menu in Windows 10, do the following.

  1. Open Registry Editor.
  2. Go to the following Registry key:
    HKEY_CURRENT_USER\SOFTWARE\Classes\Directory

    Tip: see How to jump to the desired registry key with one click

  3. Create a new subkey here called "shell":
  4. Under shell, create a new subkey. Give it some recognizable name like "openbashhere":
  5. Set the value data of the default (unnamed) value under the "openbashhere" subkey to "Open Bash here":
  6. Under the "openbashhere" subkey, create a new value of type "Expandable String Value" and name it as "Icon":
  7. Set its value data to:
    %USERPROFILE%\AppData\Local\lxss\bash.ico

    See this screenshot:

  8. Again, under the "openbashhere" key, create a new subkey called "command":
  9. Set the value data of the default (unnamed) value of the "command" subkey to:
    cmd.exe /c cd /d "%V" && bash.exe

     


    You just added Bash to the context menu of folders:

  10. Now, repeat the steps above under the key:
    HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background

    This will add the Open Bash here command to the Directory background context menu:

  11. Additionally, you can create a similar Registry structure under the key
    HKEY_CURRENT_USER\SOFTWARE\Classes\DesktopBackground

    To get

    HKEY_CURRENT_USER\SOFTWARE\Classes\DesktopBackground\shell\openbashhere\command

    Create appropriate values and their data. This will add the Open Bash here command to the context menu of the Desktop context menu.

  12. Finally, you can create the appropriate keys and values under the following key:
    HKEY_CURRENT_USER\SOFTWARE\Classes\Drive\shell\openbashhere

    This will add the Bash command to the drive context menu:

For those who want to avoid Registry editing, a ready-to-use tweak and an undo file are available for download here:

Download Registry Files

To save your time, use Winaero Tweaker. It has the appropriate option under Context Menu:You can get the app here: Download Winaero Tweaker.

Watch the following video to see this tweak in action:

Tip: you can subscribe to our YouTube channel HERE.

That's it. If you have suggestions or questions - welcome to comments.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

9 thoughts on “Add Bash Context Menu in Windows 10”

  1. any way to make this open bash window here “as administrator” instead of standard?

    also when applied to win10 pro x64 fcu with the latest winaero tweaker it seems the icon placed in the context menu is blank ><

    thanks for all your hard work. invalueable tool :)

    1. Thanks for kind words.
      For bash as administrator, replace the command in the Reg file with:
      @=”PowerShell -windowstyle hidden -Command \”Start-Process cmd.exe -ArgumentList ‘/k,cd,/d,%V,&&,bash.exe’ -Verb RunAs\””
      (I’ve not tested it myself yet but it should work).

      1. It works fine. Can you add it to Winaero Tweaker? Like the same option in powershell and cmd.

        Thank you!

  2. Hey, is there any way to run the bash from the context menu in folders with white space in the name?
    Like: “C:\Test Folder”?

    Thanks for the guide and the tools! :)

  3. This suddenly stopped working correctly on my pc. It opens a bash shell, but not in the directory clicked. Instead, it opens in “/”.

  4. The command
    cmd.exe /c cd /d “%V” && bash.exe
    fails if the selected directory is a WSL Linux path like e.g. /home or /var. For recent WSL versions, a better command is therefor
    wsl.exe –cd “%V”
    since wsl.exe can handle both Windows and Linux pathes (if “%V” starts with a “/”, it’s automatically handled as Linux path).

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.