[英]Unable to pass command line arguments in Ruby 2.0.0
I just installed Ruby 2.0.0 on Windows 7 (using "rubyinstaller-2.0.0-p247-x64.exe"). 我刚刚在Windows 7上安装了Ruby 2.0.0(使用“rubyinstaller-2.0.0-p247-x64.exe”)。 I think the File associations are OK:
我认为文件关联是可以的:
$> assoc .rb
.rb = rbfile
$> ftype rbfile
rbfile="C:\Ruby200-x64\bin\ruby.exe" "%1" %*
However, I cannot pass any arguments to the interpreter. 但是,我无法将任何参数传递给解释器。
So if I run a simple script (test.rb): 所以,如果我运行一个简单的脚本(test.rb):
puts ARGV[0]
it gives nothing: 它什么都没有:
>test.rb test1
>
I guess I should add that I had Ruby 1.9.3 installed till yesterday. 我想我应该补充一点,直到昨天我安装了Ruby 1.9.3。 I uninstalled it, and installed the above (Ruby 2.0.0).
我卸载了它,并安装了上面的(Ruby 2.0.0)。 Everything used to work fine in Ruby 1.9.3.
一切都曾经在Ruby 1.9.3中运行良好。
Please help !! 请帮忙 !!
Thanks. 谢谢。
Other people had similar problems with Vista and Ruby 1.9 in the past. 其他人在过去曾遇到类似 Vista和Ruby 1.9的问题 。 It seemed to be related to manual modifications or broken uninstalls of old versions.
它似乎与手动修改或旧版本的卸载有关。
A clean install of "rubyinstaller-2.0.0-p247-x64.exe" on Windows 7 works for me. 在Windows 7上干净安装“rubyinstaller-2.0.0-p247-x64.exe”对我来说很有用。 The
assoc
and ftype
commands do not know about ruby. 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.
I'd suggest you unset these values by starting a Shell as Administrator and running ftype rbfile=
and assoc .rb=
. 我建议您通过以管理员身份启动Shell并运行
ftype rbfile=
和assoc .rb=
取消设置这些值。 If this doesn't help (make a backup and) delete all registry keys containing rbfile
. 如果这没有帮助(进行备份)并删除包含
rbfile
所有注册表项。 The correct keys use RubyFile
or RubyWFile
. 正确的密钥使用
RubyFile
或RubyWFile
。 The InnoSetup Script contains the correct registry entries. InnoSetup脚本包含正确的注册表项。
Worked for me in Windows 7: 在Windows 7中为我工作:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.