20

What's the easiest way to determine the logged on user in Windows XP (without loading any support tools)? I'm looking for something similar to the 'whoami' command but for Windows. I need something that'll display the domain and username.

21

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

echo %userdomain%

echo %username%

11

Just type "echo %USERNAME%" into command line.

  • Damn, few second. :D – sYnfo Oct 13 '09 at 19:41
  • You deserve a +1 anyway ;-) – Ivo Flipse Oct 13 '09 at 19:43
  • 2
    I stated in the question that I was looking for something that included the domain as well as the username. – Mark Oct 14 '09 at 15:52
10

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

echo %userdomain% %username%
  • 1
    Or echo %userdomain%\%username% for down-level logon name format. – mythofechelon May 27 '15 at 10:20
6

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)

1

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.

  • 1
    You need to explain in detail how to get the wealth of information you talk about. This easily could have been a comment. – Ramhound Aug 29 '12 at 12:26
  • 3
    @Ramhound I believe I've mentioned it to you twice already, but users with less than 50 reputation are not able to post comments. – slhck Aug 29 '12 at 16:16
1

Run Notepad with Administrative Privileges and paste this piece of code into it:

@echo off
echo %computername%\%username%
exit /B

save the document as "C:\Windows\system32\whoami.bat" with quotes.

Example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.