Search code examples
shellcygwin

Open a file from Cygwin


Is there an equivalent to OSX open command in cygwin. open opens a file with the default application for that type.

I want to do something like

$ magic-command file.xls
#excel opens as if file.xls would have been double-clicked

$ magic-command file.txt
#notepad opens as if file.txt would have been double-clicked

You get the idea?

Basically something like a "cygwin-double-click" command.


Solution

  • You can also use the cygwin utility:

    cygstart <your file>
    

    To make things OSX-like add the following to your bashrc

    alias open='cygstart'
    

    Don't forget to check out the man page for cygstart.