Ethan Fischer
Ethan Fischer

Reputation: 1489

Opening explorer from bash/linux subsystem in Windows 10

Is there a command to open the current directory in windows file explorer from bash (or zsh) using bash on ubuntu on windows? I think I saw somewhere you can do explorer . but it tells me No command 'explorer' found

Upvotes: 13

Views: 20449

Answers (7)

Adam Kuzański
Adam Kuzański

Reputation: 674

1st: verify that explorer.exe works when you provide full path, run:

/mnt/c/Windows/explorer.exe

2nd: If yes, then add this path to your environment:

export PATH="/mnt/c/Windows:$PATH"

3rd: To make it work after you restart the machine:

echo 'export PATH="/mnt/c/Windows:$PATH"' >> ~/.bashrc

Upvotes: 0

sina behnam
sina behnam

Reputation: 1

explorer.exe won't work due to the mounting privileges but there is an alternative way that might work most of the time. you can install xdg-utils and after the installation, you just need to command in terminal 'xdg-open .' which '.' indicate the directory you wish to pop up.

in Ubuntu distro:

$ sudo apt install xdg-utils

and then

$ xdg-open .

Upvotes: 0

Antonio Contreras
Antonio Contreras

Reputation: 26

If you're using zsh, you can try:

$ echo 'alias <your alias|open>="/mnt/c/Windows/explorer.exe"' >> ~/.zshrc && source ~/.zshrc

bash:

$ echo 'alias <your alias|open>="/mnt/c/Windows/explorer.exe"' >> ~/.bashrc && source ~/.bashrc

Then only you can do:

 $ <your alias|open> path

Upvotes: 0

testing_22
testing_22

Reputation: 2585

Running this command below, you can create a Symlink which you can refer by /explorer.exe

sudo ln -s /mnt/c/Windows/explorer.exe explorer.exe

Now run:

/explorer.exe .

Upvotes: 0

Adam
Adam

Reputation: 10036

I wasn't able to get $ /mnt/c/Windows/explorer.exe . to work for me. What worked for me was installing Search Everything and using it to search for a file in the current directory. You can then right-click the file in the results and hit Open Path.

Upvotes: 0

heartyporridge
heartyporridge

Reputation: 1201

Since the Windows 10 Anniversary Update, you can now directly run Windows executables from Bash/WSL. Try updating Windows through Windows update, and then run the following in Bash:

$ explorer.exe .

Alternatively,

$ /mnt/c/Windows/explorer.exe .

(where c is the drive of your Windows installation`). This will open a new Explorer window in the current directory.

Upvotes: 22

asatsi
asatsi

Reputation: 472

This works well for me on my GIT bash on windows 10.

$ which explorer
/c/Windows/explorer
$ explorer .

Upvotes: 0

Related Questions