如何从 Windows 注册表中查找登录用户?

How to find logged in user from Windows Registry?

正在使用 C# 和 xaml 开发 windows 商店 8.1 应用程序。

在我的应用程序中,我想从 Windows 注册表中查找登录用户名。

我如何从 C# 代码中获取它?

任何人都请帮助我。

此致,

桑托斯

您可以在HKEY_CURRENT_USER\Volatile Environment\USERNAME中找到用户名。 但是,我很确定您将无法从 Windows 商店应用程序访问此内容。

我建议改为查看 UserInformation.GetDomainNameAsync method or other methods in the UserInformation class。