Opening filename with a space in it

Hi all,
I’m a Ruby newbie so this is probably not the most challenging question
on the net, but, here it goes.
How can I open a filename with a space in it?
It concerns an Excel file.

system('start excel c:\temp\open it.xls’)

Excel will try to open “open.xls” and “it.xls”.

Thanks for the help guys!

FlamingFlamingo

Giel R. wrote:

Hi all,
I’m a Ruby newbie so this is probably not the most challenging question
on the net, but, here it goes.
How can I open a filename with a space in it?
It concerns an Excel file.

system('start excel c:\temp\open it.xls’)

Excel will try to open “open.xls” and “it.xls”.

Thanks for the help guys!

FlamingFlamingo

Try some quotes around the file name.

Nop, doesn’t work either.
system(‘start excel c:\temp\“open it.xls”’)

Quotes around the entire path+filename doest work.
system(‘start “excel c:\temp\open it.xls”’)
Thanks for the “push” in the right direction!

Flaming F.

Try some quotes around the file name.

-------- Original-Nachricht --------

Datum: Mon, 26 Nov 2007 17:31:30 +0900
Von: Giel R. [email protected]
An: [email protected]
Betreff: opening filename with a space in it

Hi all,
I’m a Ruby newbie so this is probably not the most challenging question
on the net, but, here it goes.
How can I open a filename with a space in it?
It concerns an Excel file.

Dear Giel,

welcome to Ruby - I am sure you’ll enjoy it :).

I vaguely recall that I also had the problem you write about and
could solve it by substituting
an underscore for the space, thus:

system('start excel c:\temp\open_it.xls’)

(Couldn’t test it now, but this :

http://support.microsoft.com/kb/142982

says something similar.)

But that’s not a Ruby-specific issue, rather an operating system
specific
one.

Best regards,

Axel

Giel R. wrote:

Nop, doesn’t work either.
system(‘start excel c:\temp\“open it.xls”’)

Quotes around the entire path+filename doest work.
system(‘start “excel c:\temp\open it.xls”’)
Thanks for the “push” in the right direction!

Flaming F.

Try some quotes around the file name.

Try:

system(‘start excel “c:\temp\open it.xls”’)

From: Giel R. [mailto:[email protected]]

Nop, doesn’t work either.

system(‘start excel c:\temp\“open it.xls”’)

Quotes around the entire path+filename doest work.

system(‘start “excel c:\temp\open it.xls”’)

Thanks for the “push” in the right direction!

you may quote the pathname only and may use single slash

system(‘start excel “c:\temp\open it.xls”’)

kind regards -botp

Siep K. wrote:

Giel R. wrote:

Nop, doesn’t work either.
system(‘start excel c:\temp\“open it.xls”’)

Quotes around the entire path+filename doest work.
system(‘start “excel c:\temp\open it.xls”’)
Thanks for the “push” in the right direction!

Flaming F.

Try some quotes around the file name.

Try:

system(‘start excel “c:\temp\open it.xls”’)

This one works!

Cheers!