Linux – Adding Bash on Ubuntu on Windows 10 to Explorer Context Menu (Issues)

bashcommand linewindows 10windows-10-v1607windows-subsystem-for-linux

I have successfully added the Bash on Ubuntu prompt to the context menu by adding the following registry keys

[HKEY_CLASSES_ROOT\Directory\shell\bash]
@="Bash Here"
[HKEY_CLASSES_ROOT\Directory\shell\bash\command]
@="C:\\Windows\\System32\\bash.exe"

Now, the above solution has two major issues one issue which I do not know how to address.

The problem is that the path to which it launches is actually that of the parent directory, not the one being right clicked.

I tried including additional arguments to the launch command, however, that results in the prompt being closed immediately before even having a chance to read any error information.

The default command from the shortcut C:\Windows\System32\bash.exe ~ does indeed work and put me in /home/user/

UPDATE: It seems that executing C:\Windows\System32\bash.exe uses a set of settings stored under [HKEY_CURRENT_USER\Console\%SystemRoot%_system32_bash.exe] as well as some (colors for instance) from the default location [HKEY_CURRENT_USER\Console], so once those settings are saved they do successfully reload. Whereas, the shortcut created on install seems to use the settings assigned to cmd.exe (to be confirmed)

UPDATE 2: Please do not offer solutions involving launching bash.exe from inside cmd.exe

Best Answer

You can find a step-by-step tutorial how to do this on this page: http://winaero.com/blog/add-bash-to-the-folder-context-menu-in-windows-10/

Additionally they offer ready-to-use registry files. I tested the registry files and they work on my Win10 x64 system.