Where does the double-clickable app live on Windows? [closed]

I'm running WSL2 with Ubuntu. I want to be able to open Ubuntu via a voice command.

To do this I run Alexa Connect on my PC to write tasks that automate some PC functionality. All I need to do is link the file path in the AC app, but no matter how hard I try, I can't find Ubuntu.exe or anything else that starts up Ubuntu. My only option is to click on it in the Start menu.

To my frustration, right clicking Ubuntu in the Start menu brings up a handful of options, and none of them are Open file location. But if I can click on it in the Start menu, there must be an accessible executable somewhere in my files that I can give to Alexa Connect.

Google has shown me where to look, and the folder directories are all where Google tells me they should be, but there are no files on display for me within those folders, and of course I have Show hidden files checked.


Solution 1:

Short answer

wsl.exe or wsl should work. It can be found in C:\Windows\System32.

More detail

But if I can click on it in the start menu, there must be an accessible executable

Well ... There is for Ubuntu, but there doesn't have to be. Apps installed from the Microsoft Store are not traditional Windows "executables". They are Appx packages with a manifest and resources, and they aren't launched with a traditional "command line." For some "extra reading" on the topic, check out my two answers (yes, two) on this Super User question. But do that later -- Finish reading here for a "quick-and-dirty" answer.

Ubuntu does provide a "fake .exe" that is known as an "App Execution Alias" to launch the Store/UWP/Appx app/package. For some other WSL distributions, that's not an option. If you ever come across this, the answer is in that other Super User question I linked to.

But if you aren't finding ubuntu.exe, then it's likely that you installed a "versioned" Ubuntu from the Store. There are (currently) three "releases" in the Microsoft Store:

  • "Ubuntu": The "Ubuntu" without a version number is always the latest LTS release available. Before 20.04 came out, if you were to install "Ubuntu" (without a version), you would have installed 18.04. Now, this installed 20.04. The app execution alias for this is simply ubuntu.exe. Since that's not working for you, my guess is you installed one of the other two.

    When 22.04 comes out (presumably) it will be updated to 22.04. But note that your WSL instance won't be automatically updated; just the Store package. It's a bit confusing, and I attempt to explain it better in this answer.

  • "Ubuntu 20.04": Always installs 20.04 and will always install 20.04, even after the "latest" has changed. So currently, "Ubuntu 20.04" and "Ubuntu" install the same thing on your system. The app execution alias, however, is different -- ubuntu2004.exe.

  • "Ubuntu 18.04": Which was the latest at one point, but since it is still a supported release, it is still installable from the Store. It's app execution alias is ubuntu1804.exe.

  • "Ubuntu 16.04": Has been removed from the Store, but some systems may still have it around.

You can see the App Execution Aliases on your system by going to "Manage app execution aliases" in the Start Menu or Settings. You can turn off the alias, so if you find that your Ubuntu (whatever version) is turned off, simply re-enable it.

But don't use the App Execution Alias under most circumstances

All that being said, launching WSL via ubuntu.exe or any of the app execution aliases is the "old way". The wsl.exe command is the "replacement" for day-to-day use. You should just be able to run wsl and have Ubuntu launch, assuming it is your only installed WSL instance.

If you had more than one instance installed, you could use wsl -d <distro>. Or wsl -u root to launch as root in your instance. wsl --help will give you the full list of flags and options.