Skip to content

Instantly share code, notes, and snippets.

@Ashwinning
Last active April 11, 2022 14:31
Show Gist options
  • Save Ashwinning/d253cb86ad9cad6f904375e401483cfa to your computer and use it in GitHub Desktop.
Save Ashwinning/d253cb86ad9cad6f904375e401483cfa to your computer and use it in GitHub Desktop.
Add Bash on Ubuntu on Windows to context menu #gistblog #ubuntu #bash #windows

Add Bash on Ubuntu on Windows to context menu

Bash on Ubuntu on Windows (installation instructions) is a Linux Subsystem for Windows.

To add it to the Windows right click context menu, perform the following steps:

  • Open regedit from the run menu Win + R.

  • Under HKEY_CLASSES_ROOT\Directory\Background\shell create a key called Bash on Ubuntu on Windows.

  • Now add a string value to this key called Icon with a path to the desired icon "%USERPROFILE%\AppData\Local\lxss\bash.ico" (including quotes).

  • Create a new key called Command under Bash on Ubuntu on Windows.

  • Change the default value to the path where your bash.exe is, like C:\Windows\System32\bash.exe.

@twocs
Copy link

twocs commented Jul 30, 2020

Change the directory to that as well:
wsl.exe --distribution Ubuntu-20.04 --cd "%V"

(Working on 19042.421)

@chiqui3d
Copy link

Change the directory to that as well:
wsl.exe --distribution Ubuntu-20.04 --cd "%V"

(Working on 19042.421)

Thanks bro, Better yet, open it with Windows Terminal:

wt -p "Ubuntu18" wsl.exe -d Ubuntu18 -u myusername --cd "%V"

I couldn't find the ubuntu icon in the system, so I downloaded it from here in ico format. https://iconarchive.com/show/simply-styled-icons-by-dakirby309/OS-Ubuntu-icon.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment