[英]Ruby/Rails: pass arguments to command line application from rake task
[英]Unable to pass command line arguments in Ruby 2.0.0
我刚刚在Windows 7上安装了Ruby 2.0.0(使用“rubyinstaller-2.0.0-p247-x64.exe”)。 我认为文件关联是可以的:
$> assoc .rb
.rb = rbfile
$> ftype rbfile
rbfile="C:\Ruby200-x64\bin\ruby.exe" "%1" %*
但是,我无法将任何参数传递给解释器。
所以,如果我运行一个简单的脚本(test.rb):
puts ARGV[0]
它什么都没有:
>test.rb test1
>
我想我应该补充一点,直到昨天我安装了Ruby 1.9.3。 我卸载了它,并安装了上面的(Ruby 2.0.0)。 一切都曾经在Ruby 1.9.3中运行良好。
请帮忙 !!
谢谢。
其他人在过去曾遇到类似 Vista和Ruby 1.9的问题 。 它似乎与手动修改或旧版本的卸载有关。
在Windows 7上干净安装“rubyinstaller-2.0.0-p247-x64.exe”对我来说很有用。 assoc
和ftype
命令不知道ruby。
> assoc .rb
File association not found for extension .rb
> ftype rbfile
File type 'rbfile' not found or no open command associated with it.
我建议您通过以管理员身份启动Shell并运行ftype rbfile=
和assoc .rb=
取消设置这些值。 如果这没有帮助(进行备份)并删除包含rbfile
所有注册表项。 正确的密钥使用RubyFile
或RubyWFile
。 InnoSetup脚本包含正确的注册表项。
在Windows 7中为我工作:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.