My demo.rb:
puts ARGV.size ARGV.each do |a| puts "Argument: #{a}" end
The result depends on how we run the script:
> demo.rb foo bar 0 > ruby demo.rb foo bar 2 Argument: foo Argument: bar
Why is this happening? And is there anything you can do about it?
EDIT: Thanks everyone! Here are my settings:
>assoc .rb .rb=rbFile >ftype rbFile rbFile="c:\ruby-1.8.6\bin\ruby.exe" "%1" %*
So it looks right.
But I found that
>demo.rb foo bar
starts the process with the following command line:
"C:\ruby-1.8.7\bin\ruby.exe" "c:\demo.rb"
Note that .rb is associated with 1.8.6, but 1.8.7 starts.
So, I think something else went bad?
ruby argv
alex2k8
source share