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 1:

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.

Solution 2:

You can use the start command from the CMD like this:

 cmd /c start <your file>

Solution 3:

explorer <your file>

works too. What is nice is

explorer .

opens a windows explorer window in the current directory. But then

 cygstart . 

does the same thing and does more, but I find 'explorer' slightly easier to remember.

Solution 4:

I am using Cygwin in Win7. I can run file on windows through ccygwin command line.

 cygstart <your file>

when you run this command your file will open in windows.