From: Christophe Broult Date: 2002-04-08T03:20:50+09:00 Subject: RE: How to determine login on Windows? This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C1DE60.EB2FCE50 Content-Type: text/plain > -----Original Message----- > From: ptkwt@shell1.aracnet.com [mailto:ptkwt@shell1.aracnet.com] > Sent: Saturday, April 06, 2002 2:36 AM > To: ruby-talk@ruby-lang.org > Subject: How to determine login on Windows? > > > On Unix to determine the current login you can do: > require 'etc' > puts Etc.getlogin > > But on Windows (Ruby compiled with MSVC) "require 'etc'" > fails (no Etc > module)... How could one determine the current login on Windows? In one of the scripts I wrote I use the USERNAME environment variable on Windows and the LOGNAME one on Solaris. if # platformIsWindows? ENV["USERNAME"] else ENV["LOGNAME"] end Type 'set' at the command line prompt to get a list of the available environment variable... Christophe > > Phil > ------_=_NextPart_001_01C1DE60.EB2FCE50 Content-Type: text/html Content-Transfer-Encoding: quoted-printable RE: How to determine login on Windows?

> -----Original Message-----
> From: ptkwt@shell1.aracnet.com [mailto:ptkwt@shell1.aracnet.com= ]
> Sent: Saturday, April 06, 2002 2:36 AM
> To: ruby-talk@ruby-lang.org
> Subject: How to determine login on = Windows?
>
>
> On Unix to determine the current login you can = do:
> require 'etc'
> puts Etc.getlogin
>
> But on Windows (Ruby compiled with MSVC) = "require 'etc'"
> fails (no Etc
> module)...  How could one determine the = current login on Windows?

In one of the scripts I wrote I use the USERNAME = environment variable
on Windows and the LOGNAME one on Solaris.

if # platformIsWindows?
     = ENV["USERNAME"]
else
     = ENV["LOGNAME"]
end

Type 'set' at the command line prompt to get a list = of the available
environment variable...

Christophe

>
> Phil
>

------_=_NextPart_001_01C1DE60.EB2FCE50--