Open a file from Cygwin

Mo. picture Mo. · Feb 23, 2009 · Viewed 64.1k times · Source

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.

Answer

erichui picture erichui · Feb 23, 2009

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.