Languages
[Edit]
EN

Windows - open file using Bash (via File Explorer)

3 points
Created by:
Khloe-Kaiser
578

This article, will show you how to open files via File Explorer using Bash on Windows.

Quick solution:

'C:/Windows/explorer.exe' /path/to/file

 

Reusable solution

In this section, you can find how create reusable alias and use it to open indicated files via File Explorer using Bash.

Simple steps:

  1. go to user home directory,
    e.g. under Bash run the command:
    cd ~
    e.g. in File Explorer use the path:
    %homedrive%%homepath%
     
  2. add to .bash_profile file the following line:
    alias explorer='C:/Windows/explorer.exe'
     
  3. re-run Bash or run in existing Bash source ~/.bash_profile command,
     
  4. from now, you can open any file using explorer command, e.g.:
    explorer /path/to/file

 

Practical example:

Open files via File Explorer using Bash on Windows.
Open files via File Explorer using Bash on Windows.
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Bash

Windows - open file using Bash script
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join