Get XP Username

BlitzMax Forums/BlitzMax Programming/Get XP Username

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Or a one-liner:

Print getenv_("username") 


Windows automatically keeps a bunch of environment variables that can be read by any program. This includes username as mentioned above, but also other useful information such as:

- installation directory for windows ("windir")
- your personal directory ("userprofile")
- the location of your program file directory ("programfiles")
and a bunch of other info. To see the full list, open a DOS command prompt (cmd.exe), and simply type: set