How to determine logged on user in Windows XP?

8,722

Solution 1

Nevermind, I figured it out. Open a command prompt and type the following:

echo %userdomain%
echo %username%

Solution 2

Just type the following into command line:

echo %USERNAME%

Solution 3

You can combine to get domain and user in one call.

echo %userdomain% %username%

Solution 4

This definitely isn't the easiest way to find out, it's probably more for the Jackie Chan fans. Install the following:

Windows XP Service Pack 2 Support Tools

Then run the following command:

whoami

(This command is available in later versions of Windows but you need to install the file above to use it in XP)

Solution 5

If you go to a command prompt and type set, you get a wealth of information. If note is the homepath variable. In an older machine that may or may not have had the profiles remapped, it tells you the current path in use.

There is also a lot of other information, including username and domain.

These are all system variables that can be individually "Echoed" as suggested above.

Share:
8,722

Related videos on Youtube

Vincent Dagpin
Author by

Vincent Dagpin

Updated on September 17, 2022

Comments

  • Vincent Dagpin
    Vincent Dagpin over 1 year

    How do I make a control array for buttons in VB.NET? Like in Visual Basic 6.0...

    Is it possible that the syntax can be like the following?

     dim a as button
    
     for each a as button in myForm
       a.text = "hello"
     next
    
  • sYnfo
    sYnfo over 14 years
    Damn, few second. :D
  • Ivo Flipse
    Ivo Flipse over 14 years
    You deserve a +1 anyway ;-)
  • Mark
    Mark over 14 years
    I stated in the question that I was looking for something that included the domain as well as the username.
  • Anuraj
    Anuraj about 13 years
    Control Array in VB is different I think
  • Konrad Rudolph
    Konrad Rudolph about 13 years
    @vsdev It’s only different because of necessity: VB6 didn’t allow putting controls into ordinary arrays.
  • Vincent Dagpin
    Vincent Dagpin about 13 years
    just additional question sir.. :) in button collections, how to detect if what button did i clicked..
  • Ramhound
    Ramhound over 11 years
    You need to explain in detail how to get the wealth of information you talk about. This easily could have been a comment.
  • slhck
    slhck over 11 years
    @Ramhound I believe I've mentioned it to you twice already, but users with less than 50 reputation are not able to post comments.
  • mythofechelon
    mythofechelon almost 9 years
    Or echo %userdomain%\%username% for down-level logon name format.