/
/

How to Add ‘Open Bash window here’ in the Windows 10 context menu

How to Add Open Bash Window here in the Windows 10 Context Menu blog banner image

The ‘Open Bash window here’ context menu option provides quick access to the Bash terminal in any folder by right-clicking. It streamlines workflows for users of Windows Subsystem for Linux (WSL). Adding this option enhances efficiency, while removing it declutters the menu for users who don’t require it.

Developers use WSL in Windows 10 through the Bash shell. However, accessing Bash via the graphical interface can be time-consuming because a shortcut is not automatically added to the context menu after installation.

Having ‘Open Bash window here’ in Windows 10 in the context menu makes the task easier, improves your workflow, and streamlines navigation. Keep reading to learn how to add or remove it, or jump to What the ‘Open Bash window here’ is, and why add or remove it.

How to add ‘Open Bash window here’ to the context menu

Advanced users, IT professionals, and developers in Windows 10 can follow a few straightforward steps to customize the context menu and conveniently open the command window here for Bash. This can help users launch Bash from anywhere when needed.

Note that editing the options on the context menu requires administrator privileges. It is best to back up the registry before following the steps below to make it easier to restore later if you make any errors.

  1. Before anything, ensure you have installed WSL on the device.
    1. Open PowerShell as Administrator. Press the Windows key + X and select Windows Terminal (Admin) or PowerShell (Admin).
    2. Run the command below to check if you have WSL installed:
      wsl –list –verbose
      If you have WSL installed, it should display all installed Linux distributions. If not, you’ll get an error message.
    3. To install WSL, use this command:
      wsl –install
      You can also install it by opening the Control Panel, clicking Programs, and selecting the Turn Windows features on or off. Tick the boxes for Virtual Machine Platform and Windows Subsystem for Linux.
    4. Restart your computer when prompted. The changes will not be effective until the system is rebooted.
  2. Open the Registry Editor. Press the Windows key + R and type regedit, then click OK.
  3. On the left panel, navigate to this path:
    HKEY_CLASSES_ROOT\Directory\Background\shell
  4. Right-click on the shell folder, select New, click on Key, and name it Bash.
  5. Right-click on Bash and create a new Key named command.
  6. Set the command to launch Bash by clicking the newly created command folder and double-clicking the Default file on the right pane. This will open the Edit string window.
  7. Paste the file location path of Bash on your device. To find this path:
    1. Search for Bash in the Start menu.
    2. Right-click on the Bash app result, and select Open file location.
    3. Right-click on the Bash shortcut in the new window, then choose Open file location.
    4. Press and hold Shift, then right-click on the Bash executable and select Copy as path.
  8. Click OK.
  9. Rename the menu option by clicking on the Bash folder, double-clicking the Default file on the right pane, and changing the value to Open Bash window here.
  10. Click OK and close the Registry Editor.
  11. Check for the correct menu shift. Right-click the ‘Open Bash window here‘ context menu on any folder or the desktop.

How to remove ‘Open Windows Bash here’ from the context menu

The context menu may look cramped to some users if they no longer use Bash scripting or seldom use it. Fortunately, you can easily remove it and declutter the menu when right-clicking on a drive or folder. Again, always back up your registry to avoid irreversible system failure if you make a mistake while editing.

  1. Open the Registry Editor by hitting the Windows key + R, typing regedit, and clicking OK.
  2. On the left pane, follow this path:
    HKEY_CLASSES_ROOT\Directory\Background\shell
  3. Under shell, delete the Bash key (or the key you created for opening Bash) to remove the command for launching the shell.
  4. Close the Registry Editor and check if the ‘Open Bash window here‘ option is removed by right-clicking on the desktop or within a folder.

What the ‘Open Bash window here’ is, and why add or remove it

What is the ‘Open Bash window here’ context menu option

The ‘Open Bash window here‘ shortcut lets you access the Bash terminal application from any folder through the right-click menu. Deploying this shortcut allows IT professionals, system developers, and advanced users to use the Windows Subsystem for Linux (WSL) quickly and efficiently. You just have to learn how to add to the Windows context menu, which you can see when you right-click on the desktop, on a drive, or within a folder.

Why add or remove the ‘Open Bash here’ in Windows 10

Users can improve their workflows if the menu is readily available in whatever directory they are working in. This eliminates the need to open the Bash terminal manually. You can have a more seamless process where you don’t need to exit your current workspace.

Conversely, removing the option offers users a cleaner context menu, especially if they don’t use the Bash terminal. Regardless, having the ability to add or remove the ‘Open Bash here’ in Windows is a good feature for everyone using WSL.

Troubleshooting common issues

You may encounter some problems after adding or removing the ‘Open Bash window here’ option in the context menu if the steps are not followed correctly. Consider the following fixes:

Does the Bash window fail to open from the context menu?

First, check if you put the right path to the Bash shell in the Default file under the command key in the Registry Editor. If you did that right, verify that you set your default WSL distribution correctly. Use the command below in the Command Prompt or PowerShell and find the distribution with the asterisk (default):

wsl -l -v

You might also want to update WSL. If you have an outdated version, it can cause compatibility problems and make the shortcut fail. To update WSL, run this command on PowerShell or Command Prompt as an Administrator:

wsl –update

Does the context menu option still appear after you tried to remove it?

Check the Registry Editor and delete the folder you created named Bash. You can also restore a registry backup from before you added the option in the context menu.

Is the ‘Open Bash window here’ option missing after enabling WSL?

Restart your computer to ensure you apply all the changes. You should also ensure you installed and configured WSL properly for the shortcut to work.

Frequently Asked Questions (FAQs)

1. What is Windows Subsystem for Linux (WSL)?

Windows Subsystem for Linux (WSL) is a feature that lets developers and users run Linux tools and terminal environments directly on Windows, bypassing virtual machines and dual booting.

2. Does this work with all Linux distributions installed on WSL?

Yes, the steps discussed will work with any correctly configured Linux distribution. However, the ‘Open Bash window here’ command will launch the default WSL distribution if multiple distributions and versions are installed. The default is the one with the asterisk on the list of all installed distributions.

3. Can I open PowerShell instead of Bash using this method?

Yes, you can open PowerShell instead of Bash, but you must modify some steps while working on the Registry Editor. For example, you must create a PowerShell key and use the path to PowerShell instead of making a Bash key with the path to Bash. But before you make changes, check if the “Open PowerShell window here” is already in the context menu by pressing the Shift key while right-clicking on the desktop or a folder. This should prevent overwritten commands that may cause errors.

4. How do I check if I have WSL installed on my system?

To check if WSL is installed, press Windows key + X, select Windows Terminal (Admin) or PowerShell (Admin), then run this command:

wsl -l -v

You should see various Linux distributions if you have it installed or an error message if not.

5. Does removing this option affect my Linux installations?

Correctly removing the ‘Open Bash window here’ option from the context menu should not affect your Linux installations. It will only free up space from the menu that appears when you right-click on the desktop or in a folder.

Adding or removing the ‘Open Bash window here’ option saves time

The ‘Open Bash window here’ option is a useful shortcut for launching Bash in a specific directory. If you always use Linux commands in Windows, adding this option can improve your work process. On the other hand, removing it ensures you only have the necessary options in the context menu. Knowing how to add or remove this option and troubleshoot as needed allows you to use your time wisely while doing your tasks on your device.

You might also like

Ready to simplify the hardest parts of IT?
×

See NinjaOne in action!

By submitting this form, I accept NinjaOne's privacy policy.

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).