From: Matthew John Date: 2006-01-21T00:57:41+09:00 Subject: Re: Which Directory was my ruby script run from? I've written a little script to test, and it looks like the second reply by Mike is the only one that works. The other two provide me with the location of the file, not the directory where the file was run from. My script is in c:\sparkdriver\bin and this is set in my path. When I run the the testfile.rb script from the c:\Documents and Settings folder I get the following results:- C:\Documents and Settings>testfile.rb Physical Location of File c:\sparkdriver\bin c:/sparkdriver/bin - File.dirname($PROGRAM_NAME) C:/Documents and Settings - Dir.getwd c:/sparkdriver/bin - File.dirname($0) ---- testfile.rb puts "Physical Location of File c:\\sparkdriver\\bin\n\n" dir = File.dirname($PROGRAM_NAME) puts dir + ' - File.dirname($PROGRAM_NAME)' dir = Dir.getwd puts dir + ' - Dir.getwd' dir =File.dirname($0) puts dir + ' - File.dirname($0)' Thanks for your help. Matthew John -- Posted via http://www.ruby-forum.com/.