Start WSL Ubuntu in specific or current folder on Windows

I'm on Windows 10 Home with May Update and have Ubuntu 18.04 for WSL installed, I can open the console in any folder with Shift + Right Click and selecting the Open Linux shell here option


ubuntu run

run <command line>
   Run the provided command line in the current working directory. If no
   command line is provided, the default shell is launched.

As far as I can tell the effect is the same as running ubuntu, except that it starts in the current directory.

This command works even as a right click open here command in explorer. Adapting from this article:

  • RegEdit to HKEY_CLASSES_ROOT\Directory\Background\shell and create a new key
  • edit (Default) to "Open Ubuntu here" or similar.
  • add a key named command
  • edit (Default) to ubuntu run

Now you have a functional "Open Ubuntu here" right click menu in explorer.


The problem I have with wsl is that the wsl bash window doesn't have the Ubuntu icon, even if it starts the Ubuntu distribution.


If you check in Task Manager how the explorer "Open Linux shell here" option opens wsl, you can see that there's a "--cd" option.