[Q]: How can I get the logged in users username on Win32?

Mark Hammond MarkH at ActiveState.com
Wed Mar 14 17:52:01 EST 2001


nomad wrote:

> Howzit,
> 
> After searching through the Python Docs, I found that on Un*x I could
> use getpass.getuser(), but there is no equivalent for the Win32
> platform.
> 
> In other words, how can I get the username in Windows?
> 
> As a side note, how can I enable Windows Scripting Host support for
> python - there is mention of python in the original WSH docs - and if
> I can use python scripts in WSH how would I call the built-in
> Wscript.<methods>
> 
> TIA
> 
> nomad

win32api.GetUserName()

For WSH examples, check out the win32com\test directory.

Mark.




More information about the Python-list mailing list