tags:

views:

1517

answers:

4

Hello,

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.xls would have been double-clicked

You get the idea?

Basically something like a "cygwin-double-click"

+3  A: 

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

 cmd /c start <your file>
f3lix
+1  A: 

Under the Windows command-line interpreter (cmd.exe) there is support for the start command. I know of somebody who implemented start in cygwin. You can find the page about it here.

You could also simply call cmd.exe (usually located in /cygdrive/c/windows/system32/cmd.exe) with the following arguments cmd /c "start yourfile.file"

Pierre-Luc Simard
+14  A: 

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.

erichui
This is really handy! With cygstart you can also run the Edit, Print, etc. actions on files... I'm glad you posted this
f3lix
This one appears "cleaner" - therefore I accepted it
Mo
A: 

If, like me, you are using putty to ssh locally on your windows machine to Cygwin as cmd.exe is a terrible console, you may want to change your sshd service to allow it to access the local desktop (this will only work on certain windows flavors) under the sshd windows service Logon properties.

Marius