From: Philip Hallstrom Date: 2007-01-12T03:35:30+09:00 Subject: Re: Finding path to ruby script argument > When I execute a ruby script by the following: > > ruby helloworld.rb onlyarg > > How can I find what equals? $0 will give you the full string... then use chop it up using dirname to get the directory... % cat foo.rb puts File.dirname($0) % ruby /Users/philip/foo.rb /Users/philip > > For example, in Windows, ruby C:\scripts\helloworld.rb onlyarg > > helloworld.rb: > ---------------------------------------------- > # What can I put here to display the value C:\scripts\ or C:\scripts? > puts ARGV[0] > ---------------------------------------------- > > output: > ---------------------------------------------- > onlyarg > ---------------------------------------------- > > > Thanks! > > Matthew > >