Python: get currently logged user and his/her special folders
Does this code win32api.GetUserName()
works fine on all win system from win 2000 to win 7 ?
What about if user is not local user but domain user, does it still work ?
When i use this function shell.SHGetFolderPath(0, shellcon.CSIDL_someDirectory, 0, 0)
, do I g开发者_StackOverflowet wanted folder for currently logged user ?
Any help appreciated.
There is a module called getpass which has a getpass.getuser() function. This should work on all windows versions. It did on all the versions I've tried anyway. The user I've used wasn't local either.
精彩评论