Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by Anonymous Monk
on Nov 10, 2011 at 12:32 UTC ( #937365=note: print w/ replies, xml ) Need Help??


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 (Prior) 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 (Chaplain) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://937365]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (15)
As of 2015-07-07 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls