1

I need to get the logged in user's name in a WPF application I'm working on. I've seen this question for a few years back. But now I'm wondering about the Environment.UserName command; will it return the same result whether or not it runs on a Windows 7, Windows 8.x or Windows 10 machine?

Community
  • 1
  • 1
Rod
  • 4,107
  • 12
  • 57
  • 81
  • I thought it did. Just got a user emailing me, because the Environment.UserName is returning the text '%username%' instead of 'Bob' – mdiehl13 Mar 21 '17 at 17:39
  • I think it may do with not being a 'local' account. There are some other stackoverflows on this: http://stackoverflow.com/questions/33394019/get-username-in-a-windows-10-c-sharp-uwp-universal-windows-app – mdiehl13 Mar 21 '17 at 18:06

1 Answers1

3

According to the MSDN, yes it will.

AWinkle
  • 673
  • 8
  • 18