in reply to Re: How to get system user name from windows using perl
in thread How to get system user name from windows using perl
Au contraire, Windows absolutely does maintain the current user information. Although there isn't a native command to get it, a a quick Googling came across these options:
- http://access.mvps.org/access/api/api0008.htm
- http://support.microsoft.com/kb/111544
- http://www.spiration.co.uk/post/1367/Get-Windows-username-of-current-user---C%23
- http://stackoverflow.com/questions/2085744/how-to-get-current-username-in-windows-powershell
For a native Perl solution, there is: http://stackoverflow.com/questions/3526420/how-do-i-get-the-current-user-in-perl-in-a-portable-way/3531096#3531096. To keep information at PerlMonks, the answer cited refers to using Win32 which has a LoginName function (which doesn't return domain, if you're using Active Directory) or Win32::pwent.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How to get system user name from windows using perl
by Anonymous Monk on Nov 10, 2011 at 16:08 UTC | |
by Sinistral (Monsignor) on Nov 11, 2011 at 15:18 UTC |
In Section
Seekers of Perl Wisdom