Windows subsystem for Linux gives Windows 10 users a Linux shell on Windows machine making it infinitely easier to use Linux without having to switch to a different system. In some cases, users might just be able to forgo having a separate Linux system altogether and get things done with just a Windows system. If you’re still learning to use WSL, you might be wondering how you can open files from Windows Subsystem for Linux. You can do so with a simple command.
Open files from WSL
In order to open files from WSL, you need to know the command and you need to know the complete path to the file you want to open. The path can be copied from File Explorer.
Once you have the path to the file you want to open, open Bash. You can use Windows search to open it, however, if it doesn’t appear in the search results, you likely have not enabled WSL on your system or you have not installed Linux on it after enabling it. Go ahead and enable WSL and install Ubuntu from the Microsoft Store.
Run the following command. Replace ‘complete-path-to-file’ with the complete path to the file you want to open.
cmd.exe /C start "complete-path-to-file"
cmd.exe /C start "D:\1A.png"
The file will, of course, open using an app that’s installed on your Windows 10 PC. In fact, it will open in the default app that’s set for that particular file type.
You can use this same command to open an app on Windows 10. All you need to do is enter the path to the EXE or a shortcut of the app.
cmd.exe /C start notepad.exe
With Notepad, you don’t need the complete path but with other third-party apps that you’ve installed, and quite a few stock ones as well, you will need the complete path. This won’t work for UWP apps however it will work for files that open in UWP apps. For example, if you still have the old Edge app on your Windows 10 PC and you’ve set it as the default PDF viewer, you will be able to use the command given above to open a PDF file in Edge however, you will not be able to use above command to open Edge since UWPs do not have an EXE.
There is a simple workaround to this though; an app shortcut. Create an app shortcut to the UWP app that you want to be able to open from WSL, get the complete path to the shortcut, and use it with the command given above. It will open the UWP.