美文网首页
Windows-API by Python

Windows-API by Python

作者: Bug2Coder | 来源:发表于2019-08-20 16:04 被阅读0次

模块:Pywin32

文档:http://timgolden.me.uk/pywin32-docs/contents.html

1、用户类
1. 账户名、用户名、用户SID
accountName = win32api.GetUserName()  # 账户名

PySID, UserName, SessionId = win32security.LookupAccountName("", string)  # 参数1:系统名(可为空)、参数2:账户名
返回值说明:
accountName:账户名  # 一般为 Administrator
Pysid:sid类,解析方式
sid = Pysid.__str__().replace('PySID:', '')  # 得到标准sid字符串
UserName:用户名
SessionId:会话ID

相关文章

网友评论

      本文标题:Windows-API by Python

      本文链接:https://www.haomeiwen.com/subject/cbppsctx.html