Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Script for getting Windows Logon Id?

Status
Not open for further replies.

subendu

Programmer
Feb 13, 2003
41
0
0
US
Can anyone give me a perl script to get the windows logon id?

Thanks in advance.

Subendu
 
The login id is one of the values in the %ENV hash.
Try this
Code:
print qq($_ => $ENV{$_}\n) for (sort keys %ENV)
to see what's in there.
 
You can also use the Win32 module.

Win32::LoginName()
[CORE] Returns the username of the owner of the current perl process.


Example:

use Win32;
$name = Win32::LoginName;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top