Are you a developer and often use Bash on Windows 10?
Do you want to access folders from Bash easily from the context menu?
The Bash was added to Windows 10 in the Anniversary Update. This feature allowed developers and power users to benefit from the tools and commands that Linux (ubuntu) provide. This major step took place in order to encourage developers and Linux enthusiasts to upgrade or migrate to Windows 10, since you can’t get Bash natively on older versions of Windows.
Bash in Windows 10 is an optional feature so it isn’t built-in like the Command Prompt. If you wish to run Bash as admin from the context menu, and be capable to open it in any folder you should do a Registry trick which you will discover in this tutorial.
Run Bash from Context Menu on Any Folder
How to Enable Bash on Windows 10
Before you may run Bash as admin, you have to be sure you’ve installed it. The method is pretty easy; allow developer mode within the Settings app under For Developers. You’ll need admin rights to allow it.
After you turn it on, open the “Control Panel” > “Programs and features” and click on “Turn Windows features on or off“.
Check in the list the option “Windows Subsystem for Linux (Beta)“. Click “OK“.
Now open the command prompt as administrator (Win+X, A) and run the command
bash, type “y“, type in the desired username and password (two times).
This will download the necessary files from Windows Store and enable Bash on your system. After this just search for “Bash” in Start menu to be able to launch it.
Now that we have installed Bash, let’s see how we can enable accessing it from the context menu on any folder on your system.
How to Edit Registry to Run Bash as Admin
It’s fairly straightforward to run Bash as admin however it simply isn’t doable from the right-click context menu. You possibly can launch the Bash app from the Windows Search menu or the Start menu however you can’t open it immediately in a folder.
Open the Windows Registry. Type “regedit” within the search bar and open it with administrative privileges.
Use the arrows in the left side of keys to navigate to this path in the Registry Editor.
Create a brand new key under the key “shell” named as “AdminBash“. The brand new key may have a default string worth.
Select the newly created key “AdminBash” and double-click on the “(Default)” string value and give it the following value:
Run Bash As Admin
You may give it any name you want, just make sure it’s clear that it’s clearly describing its primary function.
Subsequent, within the AdminBash key you created, create another key and title it “command“. Inside this key, just like the earlier one, there’s a string referred to as “(Default)“. Double-click it and alter the value of it to the following:
powershell -c begin -verb runas cmd '/c begin /D """%V""" bash.exe'
Restart Explorer.exe for good measure. To do this hold CTRL+SHIFT and right-click on the task bar and choose “Exit Explorer“.
Now use (CTRL+SHIFT+ESC) key combination or (CTRL+ALT+DEL) to open the Task Manager. In the menu up top choose “File” > “Run new task“.
explorer in the window “Create new task” and click “OK“.
Right-click on a folder and choose “Run Bash Ad Admin“.
There you have it!
I hope this tutorial helped you improve your productivity and earn some time using Bash on Windows 10!
Feel free to share this tutorial with your friends, sharing is caring.