Ruby's ARGV can be empty on windows depending on a way to run script

后端 未结 5 660
梦如初夏
梦如初夏 2021-01-12 16:27

My demo.rb:

puts ARGV.size

ARGV.each do |a|
  puts \"Argument: #{a}\"
end

The result depends on how we run a script:

>          


        
5条回答
  •  隐瞒了意图╮
    2021-01-12 16:43

    Open a command window:

    assoc .rb
    

    is it rbFile?

    ftype rbFile
    

    Make sure that Ruby.exe is followed by "%1" %*

    the %* is sometimes missing.

提交回复
热议问题