Ruby's ARGV can be empty on windows depending on a way to run script
问题 My demo.rb: puts ARGV.size ARGV.each do |a| puts "Argument: #{a}" end The result depends on how we run a script: > demo.rb foo bar 0 > ruby demo.rb foo bar 2 Argument: foo Argument: bar Why this happens? And can some thing be done with this? EDIT: Thanks to all replies! Here my settings: >assoc .rb .rb=rbFile >ftype rbFile rbFile="c:\ruby-1.8.6\bin\ruby.exe" "%1" %* So it looks right. But I have discovered that >demo.rb foo bar starts process with such Command Line: "C:\ruby-1.8.7\bin\ruby