Mo.
Mo.

Reputation: 15353

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.

Upvotes: 116

Views: 73400

Answers (7)

Oriol Prat
Oriol Prat

Reputation: 1047

Yes, there is an equivalent to Windows, try with xdg-open <your file>

Upvotes: 0

Junaid
Junaid

Reputation: 2470

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.

Upvotes: 3

pheon
pheon

Reputation: 3009

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.

Upvotes: 16

Marius
Marius

Reputation: 3511

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.

Upvotes: 0

erichui
erichui

Reputation: 2771

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.

Upvotes: 202

Pierre-Luc Simard
Pierre-Luc Simard

Reputation: 2721

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"

Upvotes: 0

f3lix
f3lix

Reputation: 29875

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

 cmd /c start <your file>

Upvotes: 16

Related Questions