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

···

--
Posted via http://www.ruby-forum.com/.

Giel Raijmakers 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.

···

--
Posted via http://www.ruby-forum.com/\.

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

Datum: Mon, 26 Nov 2007 17:31:30 +0900
Von: Giel Raijmakers <giel@degekste.com>
An: ruby-talk@ruby-lang.org
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

···

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

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

Thanks for the help guys!

FlamingFlamingo
--
Posted via http://www.ruby-forum.com/\.

--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: GMX E-Mail ✉ sichere & kostenlose E-Mail-Adresse ✉

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 Flamingo

···

Try some quotes around the file name.

--
Posted via http://www.ruby-forum.com/\.

Giel Raijmakers 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 Flamingo

Try some quotes around the file name.

Try:

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

···

--
Posted via http://www.ruby-forum.com/\.

# Nop, doesn't work either.
# system('start excel c:\\temp\\"open it.xls"')

···

From: Giel Raijmakers [mailto:giel@degekste.com]
#
# 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 Korteling wrote:

Giel Raijmakers 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 Flamingo

Try some quotes around the file name.

Try:

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

This one works!

Cheers!

···

--
Posted via http://www.ruby-forum.com/\.