in reply to How to get system user name from windows using perl

my name and acronym and department e.t.c. how can I get that name directly from windows system.

Never heard of a windows system maintaining such information, but if you can retrieve it from the registry, you could use Win32::TieRegistry

Also, %ENV contains lots of information, like USERPROFILE...

  • Comment on Re: How to get system user name from windows using perl

Replies are listed 'Best First'.
Re^2: How to get system user name from windows using perl
by Sinistral (Monsignor) on Nov 10, 2011 at 14:01 UTC

      Au contraire, Windows absolutely does maintain the current user information.

      Where is the department name? Acronym, e.t.c?

      Reading comprehension is fun :)

        That information is available via Exchange, Active Directory, or other corporate directory structure. A standalone Windows workstation doesn't maintain such details. They can be retrieved easily, but unless the OP says what infrastructure exists in their organization we can't help

Re^2: How to get system user name from windows using perl
by Lotus1 (Vicar) on Nov 10, 2011 at 15:19 UTC

    Type SET at the command prompt to get a list of available environment variables on a Windows system.

    $ENV{USERNAME} for example.

      Caveat: %ENV is always byte semantics, if you have an oldish Windows and a username outside of the ANSI locale, you get question marks. One should be using Win32’s LoginName() instead which always returns character-shaped characters.