Skip to main content

Starting the default associated Windows program on WSL

Learn the simple command to open files like PDFs and HTML from your WSL Linux console using their default Windows application - powershell.exe.

· 2 min read
View raw
Christophe
Markdown, WSL and Docker lover ~ Insatiable curious.
Cet article existe aussi en français — lire la version française.

This article is over a year old but was reviewed on July 30, 2026 — the content is still accurate.

Starting the default associated Windows program on WSL

⚡
TL;DR

This article shares a quick WSL trick: running powershell.exe <filename> (e.g. powershell.exe guide.pdf) from the Linux console opens that file with its default Windows application, without needing to browse to it in Windows Explorer first. xdg-open is mentioned as an alternative for opening the default browser.

Very often, I'm in my Linux console and I'd like to open a pdf file that I've just generated or, more simply, to open an html file. But how can I do this?

Without knowing the tip that is the subject of this article, at the moment I launch Windows Explorer from my console, I then get the well-known file explorer interface and there I double-click on the file I want to open and leave it to Windows, which knows which program to launch to open this or that extension.

In fact, it's much simpler...

The tip: start powershell.exe followed by the filename to open like powershell.exe guide.pdf or powershell.exe index.html.

A typical use case: you've just generated a PDF with Quarto in Docker and want to check the result without leaving your console.

Not available in Bash

powershell.exe only works in the console. You can't use it in a Bash script (.sh), it won't be recognized there.

`xdg-open`

You can also use xdg-open to start your default browser so xdg-open index.html will open the file in your Windows browser.

If you get the error below, you'll find a solution in the article Windows Explorer

>Powershell

Was this article helpful?
Did you try the steps in this article?