From: "Berger, Daniel" Date: 2005-04-05T01:55:27+09:00 Subject: Re: how do I find the name of the current user? > -----Original Message----- > From: Charles Mills [mailto:cmills@freeshell.org] > Sent: Saturday, April 02, 2005 10:35 PM > To: ruby-talk ML > Subject: Re: how do I find the name of the current user? > > > > Sam Roberts wrote: > > Quoting csaba@phony_for_avoiding_spam.org, on Sun, Apr 03, 2005 at > 11:54:43AM +0900: > > > On 2005-04-03, Sam Roberts wrote: > > > > I'm thinking Etc.getlogin followed by > Etc.getpwnam.gecos might be > best > > > > on unix, is there a windowsy equivalent? > > > > > > Would this help you? > > > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/135205 > > > > It looks great, but I don't want to use it until its in the stdlib. > Its > > a little more than I want to get the name of the current user. > > > > But, I'll remember, I might need it in the future. > > > > I don't know how portable this is, but: > > irb(main):001:0> ENV["USER"] > => "cmills" > > -Charlie It's not defined on my Windows XP Pro box (though, see USERPROFILE). Also see ruby-talk:37643 for a Win32API wrapper around GetUserName(). Regards, Dan