I'm trying to get the user's full name. Not the login name, but the full name that shows up on the upper right side of the start menu in Windows 7. It might only show up as the full name in an active directory setting.
os.environ['USERNAME']
win32api.GetUserName()
These both return the login name. How do I get the user's full name?
Best Answer
A bit of googling gives me this link
and this code:
Tested and works on Windows XP
As noted by OP in comment here,
pywin32
wraps this same API call into a simpler function:GetUserName
pointing toctypes.windll.secur32.GetUserNameExW
, and3
being the same3
as the constant fromctypes