加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

无法在Ruby 2.0.0中传递命令行参数

发布时间:2020-12-16 20:59:38 所属栏目:百科 来源:网络整理
导读:我刚刚在 Windows 7上安装了 Ruby 2.0.0(使用“rubyinstaller-2.0.0-p247-x64.exe”).我认为文件关联是可以的: $ assoc .rb.rb = rbfile$ ftype rbfilerbfile="C:Ruby200-x64binruby.exe" "%1" %* 但是,我无法将任何参数传递给解释器. 所以,如果我运行一
我刚刚在 Windows 7上安装了 Ruby 2.0.0(使用“rubyinstaller-2.0.0-p247-x64.exe”).我认为文件关联是可以的:
$> assoc .rb
.rb = rbfile

$> ftype rbfile
rbfile="C:Ruby200-x64binruby.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有 similar problems.它似乎与手动修改或旧版本的卸载有关.

在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 Script包含正确的注册表项.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读