Context Menu entries to open WSL shell


I'd really like to add 'WSL Command Prompt Here' to my Opus context menu, to open a WSL (bash) shell at the current folder.

Is this possible? And if so, how?

1 Like

The command is:


If you want it on the menu you get when right-clicking the background of the file display, you can edit that via Settings > Customize Toolbars > Context Menus > Lister Context.

You could also add it to the right-click menu of folders (so you can right-click a sub-folder and open a WSL/bash shell for that folder) via Settings > File Types > All Folders > Context Menu.

(The same command also works on toolbars, hotkeys, etc.)

1 Like

Ah fantastic - that's working well....that's going to be so handy.

...but, on the right click folder one, it opens the parent folder, not the one actually selected. Do I need to add a path argument to that perhaps?

Oh, try this:

CLI DOSPROMPT=wsl,selfolder

Yep perfect - thanks so much Leo!

1 Like

I was able to get the background lister context working, which is great. But the folder context does not. When I right click on the folder and select WSL/bash shell I get an error dialog with name of the folder and a message that says "application not found"

Any ideas?

Delete the context menu item you added (you can't change its type once created).

Then add a new context menu item, and make sure you set the Type drop-down to Run and Opus Function (not supported in Explorer).

That is required to run Opus commands from context menus menus (but also means they won't appear outside of Opus, of course).

Thanks! Works great and is super useful! :slight_smile:

I am running both SUSE and Ubuntu. Is there a way to tell Directory Opus which one to use?


We might add a setting to let you override it, but at the moment we just send all commands to WSL and it then forwards them on to the default distro.

"You can change the default distro by using the “wslconfig” tool."

I have it working now, thanks Leo! I thought that I might add the following info to help others solve a problem I had upon setting my WSL shell. I had configured my Ubuntu window to match the colors and fonts from Ubuntu. However when I launched the window from my content menu under Opus, it came using the stock black and green. I found a chart to convert the existing color palate from the DOS standard to the Ubuntu color set. This change can be made to only your WSL windows by using "Properties", and all command prompt type windows using "Default".

First, make sure to select slot 3 for the Screen Background and the Popup Text and slot 16 for the Screen Text and Popup Background. Then a bit of manual input is required to enter the following RGB values for each slot.

Slot 1: Red: 78, Green: 154, Blue: 6
Slot 2: Red: 52, Green: 101, Blue: 164
Slot 3: Red: 48, Green: 10, Blue: 36
Slot 4: Red: 6, Green: 152, Blue: 154
Slot 5: Red: 204, Green: 0, Blue: 0
Slot 6: Red: 117, Green: 80, Blue: 123
Slot 7: Red: 196, Green: 160, Blue: 0
Slot 8: Red: 211, Green: 215, Blue: 207
Slot 9: Red: 85, Green: 87, Blue: 83
Slot 10: Red: 114, Green: 159, Blue: 207
Slot 11: Red: 138, Green: 226, Blue: 52
Slot 12: Red: 52, Green: 226, Blue: 226
Slot 13: Red: 239, Green: 41, Blue: 41
Slot 14: Red: 173, Green: 127, Blue: 168
Slot 15: Red: 252, Green: 233, Blue: 79
Slot 16: Red: 238, Green: 238, Blue: 238

For more details, this information was originally posted here: by James Garijo-Garde.

Ok so I have adapted this to open Windows Terminal instead (which is a huge improvement in general over previous options or CLI on Windows...). They key is to use the -d switch to specify the folder to open to.

(Note, this is opening Ubuntu for me, which I have set to be the default in the Windows Terminal settings).

I have the general context menu working fine with:

C:\Users\YOU\AppData\Local\Microsoft\WindowsApps\wt.exe -d {sourcepath} 

However, I can't quite get the right click on folders to work - have tried the above, and

C:\Users\YOU\AppData\Local\Microsoft\WindowsApps\wt.exe -d {file} 

Though it seems this should probably be added in a more offical way to the CLI options in Opus itself (!Documents/CLI_Command.htm)

Leo - any tips on getting that folder right click to work?

{file} will only give the name of the right-clicked file or folder, but you want the full path.

Use {filepath} instead, or {filepath|noterm} which avoids the extra \ on the end of folder paths which confuses some things.

Awesome - {filepath} works fine. Not sure how I missed that in looking at the arguments....sorry!

1 Like

Actually in some cases {filepath|noterm} seems required, so that's the way to go.

I got error:

--startingDirectory: 1 required TEXT missing
Run with --help for more information.

I used following function.

C:\Users<My user name>\AppData\Local\Microsoft\WindowsApps\wt.exe -d {filepath|noterm}

I went to Settings > Customize Toolbars > Context Menu > Lister Context, insert new Button. The function is the above line.


You can use CLI DOSPROMPT=wsl if you want to open a WSL prompt in the current folder.

In the code you were using, {filepath|noterm} would insert the path of the selected file or folder (the noterm part means it won't add a backslash at the end if it's a folder). That doesn't usually make sense in the Lister Context menu, since right-clicking the background normally deselects everything.

You could use {sourcepath} instead there if you want to run wt.exe and give it the current path.

Thanks Leo!

I would like to open it with Windows Terminal and my default profile is Ubuntu. I followed our suggestion. Now the command is

C:\Users<My user name>\AppData\Local\Microsoft\WindowsApps\wt.exe -d {sourcepath}

When I right click an empty space inside a folder and choose the entry I created, it did opened Ubuntu in Windows terminal, but it does not in the desired folder. It is in HOME directory.

Could this be caused by the {sourcepath} is DOS format path?

Try {sourcepath|noterm} since noterm seemed to be needed with the earlier examples. (I didn't think of that before, sorry!)

Same. It still opened in HOME directory.