Skip to content

Instantly share code, notes, and snippets.

@brndnsmth
Last active September 11, 2023 14:13
Show Gist options
  • Save brndnsmth/1940f1f8eb952e1a34457e80dfba1b46 to your computer and use it in GitHub Desktop.
Save brndnsmth/1940f1f8eb952e1a34457e80dfba1b46 to your computer and use it in GitHub Desktop.
Open the Current Directory in Windows Explorer from WSL

Opening the Current Directory in Windows Explorer from WSL

If you're working within the Windows Subsystem for Linux (WSL) and need to open the current directory in Windows Explorer, you can use the following commands. WSL automatically sets the Windows path for you.

explorer.exe .

This command will launch Windows Explorer with the current directory open.

Create an Alias for Convenience:

To make this process more convenient, you can set up an alias in your .bashrc file. This way, you can use a custom command, such as explorer, to open the current directory.

echo 'alias explorer="explorer.exe ."' >> ~/.bashrc

The above command appends an alias definition to your .bashrc file, which associates the explorer command with explorer.exe ..

Reload Your .bashrc:

After adding the alias, you need to reload your .bashrc file for the changes to take effect:

source ~/.bashrc

Then you can use:

explorer

This makes it easier to switch between your Linux command line and Windows Explorer seamlessly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment