Windows ruby.exe association with .rb

Hello,
Installing ruby 2.0.0 on winfdows, I got mismatch
with .rb assocation. Here a little cmd.exe session :

d:\usr\bin>cat vers.rb
puts [RUBY_VERSION,__FILE__].join(", ")

d:\usr\bin>ruby -v
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

d:\usr\bin>which ruby
d:\usr\Ruby\Ruby200\bin\ruby.exe

d:\usr\bin>ruby vers.rb
2.0.0, vers.rb

!!!!!
d:\usr\bin>vers.rb
1.9.3, D:/usr/bin/vers.rb
!!!!!

d:\usr\bin>assoc.rb
.rb=RubyFile

d:\usr\bin>ftype RubyFile
RubyFile="d:\usr\ruby\Ruby200\bin\ruby.exe" "%1" %*

d:\usr\bin>set | grep -i ruby
Path=C:\Program Files\ConEmu\ConEmu;d:\usr\ruby\Ruby200\bin;...
RUBYOPT=-rubygems

Does anyone know why direct invoke of "vers.rb" run a older ruby-1.9.3
version ?
(it was managed by pik)

Thank you,

···

--
Posted via http://www.ruby-forum.com/.

It's because .rb is associated with that binary. It's in the registry. Run explorer, right click on a .rb file, and choose open with. At the bottom of the context menu will be "choose default program..." use that to point it at 2.x

···

-----Original Message-----
From: Regis d'Aubarede [mailto:lists@ruby-forum.com]
Sent: Thursday, March 28, 2013 12:36 PM
To: ruby-talk ML
Subject: Windows ruby.exe association with .rb

Hello,
Installing ruby 2.0.0 on winfdows, I got mismatch with .rb assocation. Here a little cmd.exe session :

d:\usr\bin>cat vers.rb
puts [RUBY_VERSION,__FILE__].join(", ")

d:\usr\bin>ruby -v
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

d:\usr\bin>which ruby
d:\usr\Ruby\Ruby200\bin\ruby.exe

d:\usr\bin>ruby vers.rb
2.0.0, vers.rb

!!!!!
d:\usr\bin>vers.rb
1.9.3, D:/usr/bin/vers.rb
!!!!!

d:\usr\bin>assoc.rb
.rb=RubyFile

d:\usr\bin>ftype RubyFile
RubyFile="d:\usr\ruby\Ruby200\bin\ruby.exe" "%1" %*

d:\usr\bin>set | grep -i ruby
Path=C:\Program Files\ConEmu\ConEmu;d:\usr\ruby\Ruby200\bin;...
RUBYOPT=-rubygems

Does anyone know why direct invoke of "vers.rb" run a older ruby-1.9.3 version ?
(it was managed by pik)

Thank you,

--
Posted via http://www.ruby-forum.com/.

As Carey said you simply change the file association in windows. If
you're using Windows 7, you can find a guide on how to do this here:
http://windows.microsoft.com/en-us/windows7/Change-which-programs-Windows-uses-by-default

···

--
Posted via http://www.ruby-forum.com/.

I got it : destroy the association and rebuild it :

assoc .rb

.rb=RubyFile

assoc .rb=

assoc .rb

Association de fichier introuvable pour l’extension .rb

assoc .rb=RubyFile

.rb=RubyFile

ruby vers.rb

2.0.0, vers.rb

vers.rb

2.0.0, D:/usr/bin/vers.rb

thank you

···

--
Posted via http://www.ruby-forum.com/\.