Forum: Ruby Re: Full paths of Ruby interpreter and running script

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
William (Bill) Froelich (Guest)
on 2006-04-18 01:54
(Received via mailing list)
Well the full path to the running script is easy enough to get from
within Ruby and based on your needs might suffice for finding the
configuration file at runtime.

puts File.expand_path(__FILE__)    # c:/rubytest/test.rb

If you want just the directory then use this

puts File.dirname(File.expand_path(__FILE__))	# c:/rubytest

Hope this helps!

This topic is locked and can not be replied to.