From: James Edward Gray II Date: 2007-07-27T22:07:33+09:00 Subject: Re: Getting Ruby Path at runtime? On Jul 27, 2007, at 4:41 AM, Ronald Fischer wrote: > Is it possible to find out under Windows, which Ruby has been used to > run a program? > Example: A program is invoked by > > C:\inst\ruby186\bin\ruby.exe appl.rb > > Is it then possible to find out inside appl.rb the whole path > > C:\inst\ruby186\bin\ruby.exe > > ? Sure: Firefly:~/Desktop$ /usr/local/bin/ruby find_ruby.rb /usr/local/bin/ruby Firefly:~/Desktop$ /usr/bin/ruby find_ruby.rb /usr/bin/ruby Firefly:~/Desktop$ cat find_ruby.rb #!/usr/bin/env ruby -wKU require "rbconfig" puts File.join(Config::CONFIG["bindir"], Config::CONFIG ["ruby_install_name"]) __END__ Hope that helps. James Edward Gray II