开发者

Python: get currently logged user and his/her special folders

开发者 https://www.devze.com 2023-01-09 03:53 出处:网络
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 ?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消