Re: Win32Lib getUserName() problem

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...
Mike777 said...

I know this is not the preferred way of dealing with it, but maybe you can pipe the output from a SET command to a text file (or memory) and interrogate the lines until you find "USERNAME=".

If that would have worked, so would have getenv("USERNAME").

I am wondering if he simply needs to log out and then log back in to see the updated username. I'm also wondering if its really the username being queried here (i.e. jsmith472 or Compaq_Owner) or a Full Name/Real Name field (i.e. "John Smith" or "Compaq Owner").

The environment variable USERNAME is essentially the name of the folder below "C:\Documents and Settings", which is not changed when you go into Control Panel & Users and so on to change your name. That name is used when you are logging in, and is presumably held in a config file of some kind by Windows. Maybe I could search for such a file with the new name in to see where it is, but the Windows search algorithm seems to lack something fundamental. Logging off and on has no effect; because so many programs remember paths, Windows doesn't change its own internal pathname & user name, just stores a copy someplace for display purposes. I dare say *nix must do something similar because once a working environment is set up, you don't want to start changng the almost-root folder name or you'd foul most programs up.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu