[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

David Vallner

8/16/2006 9:02:00 PM

On Wed, 16 Aug 2006 22:50:03 +0200, Joe Seeley <joiey.seeley@gmail.com>
wrote:

> If I execute my apps from a command line using a syntax like this
>
> ruby my_app arg1 arg2 .. argx
>
> then all passed in arguments are handled correctly.
>
> 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?
>
> Thanks,
> Joe


Not really. PATHEXT just means that try to append those extensions to a
command you enter on the command line, and then invoke the default opener
for that file type.

The opener for ruby could be set up to run "ruby %1", where %1 is only the
script file name. I don't have a Ruby installed on my Windows boot right
now, but poke around the registry looking for what filetype the ".rb"
extension is registered to, and then search for the name of the filetype
to scrounge up what the command string is.

My memory of last doing something like this is a little vague, so no exact
syntax - but I do think the filetype opener settings use batch file
syntax, and then you should use %* in place of %<whatever> to see if it
helps.

David Vallner

1 Answer

Austin Ziegler

8/17/2006 1:15:00 PM

0

On 8/16/06, David Vallner <david@vallner.net> wrote:
> The opener for ruby could be set up to run "ruby %1", where %1 is only the
> script file name. I don't have a Ruby installed on my Windows boot right
> now, but poke around the registry looking for what filetype the ".rb"
> extension is registered to, and then search for the name of the filetype
> to scrounge up what the command string is.

C:\> ftype rbFile
rbFile="C:\Ruby\bin\ruby.exe" "%1" %*

There may be a better choice, but that's what mine is set to with a
recent install of 1.8.4.

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca