I need the username of a computer for the program I am making. And usually get it by doing something like this:
string fileLocation = "C:\\Users\\" + Environment.UserName + "\\Documents";
But on the current computer I am using(and I know others) the username was changed form JAN-PC to Tyler but the all the directories are "C:\Users\Tyler.JAN-PC\" an when I use:
It only gives "Tyler" not "Tyler.JAN-PC"
This is on Windows 7 but want it to work for windows 8 and I am using winforms.
How can I get the full username of the current user? Thanks in advance!!