[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Command line arguments in windows

Daniel Martin

8/17/2006 12:48:00 AM

"Joe Seeley" <joiey.seeley@gmail.com> writes:

> If I execute my apps from a command line using this syntax
>
> my_app arg1 arg2 .. argx
>
> then ARGV is empty!
>
> .rb exists in my PATHEXT system variable so it should be treated the same as
> a .exe. Anyone else encountered this?

This isn't what I see:

C:\Temp>type abu.rb
p ARGV

C:\Temp>abu what ever you want
["what", "ever", "you", "want"]

Now, in the registry, the default value for HKEY_CLASSES_ROOT\.rb is
"rbFile" and the default value for
HKEY_CLASSES_ROOT\rbFile\Shell\open\command is:
"c:\ruby\bin\ruby.exe" "%1" %*

I suspect that your registry entry is missing the %* bit. Go open up
regedit, find HKEY_CLASSES_ROOT\.rb, find that default value (probably
rbFile, but if it isn't use that value where I say "rbFile"), then
find the default on HKEY_CLASSES_ROOT\rbFile\Shell (probably "open"),
then look at the default on
HKEY_CLASSES_ROOT\rbFile\Shell\open\command and see if that includes
the %* bit. If it doesn't, add it.


2 Answers

Nobuyoshi Nakada

8/17/2006 6:42:00 AM

0

Hi,

At Thu, 17 Aug 2006 09:47:39 +0900,
Daniel Martin wrote in [ruby-talk:208880]:
> I suspect that your registry entry is missing the %* bit. Go open up
> regedit, find HKEY_CLASSES_ROOT\.rb, find that default value (probably
> rbFile, but if it isn't use that value where I say "rbFile"), then
> find the default on HKEY_CLASSES_ROOT\rbFile\Shell (probably "open"),
> then look at the default on
> HKEY_CLASSES_ROOT\rbFile\Shell\open\command and see if that includes
> the %* bit. If it doesn't, add it.

IIRC, assoc command built in cmd.exe does it. Try assoc /?.

--
Nobu Nakada

Nobuyoshi Nakada

8/17/2006 6:55:00 AM

0

Hi,

At Thu, 17 Aug 2006 15:42:20 +0900,
nobu@ruby-lang.org wrote in [ruby-talk:208901]:
> At Thu, 17 Aug 2006 09:47:39 +0900,
> Daniel Martin wrote in [ruby-talk:208880]:
> > I suspect that your registry entry is missing the %* bit. Go open up
> > regedit, find HKEY_CLASSES_ROOT\.rb, find that default value (probably
> > rbFile, but if it isn't use that value where I say "rbFile"), then
> > find the default on HKEY_CLASSES_ROOT\rbFile\Shell (probably "open"),
> > then look at the default on
> > HKEY_CLASSES_ROOT\rbFile\Shell\open\command and see if that includes
> > the %* bit. If it doesn't, add it.
>
> IIRC, assoc command built in cmd.exe does it. Try assoc /?.

Sorry, it was ftype.

assoc .rb=rbFile
ftype rbFile=ruby "%1" %*

--
Nobu Nakada