25

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.

Abel
  • 1,562
Mark
  • 3,177

6 Answers6

24

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

echo %userdomain%
echo %username%
galoget
  • 403
Mark
  • 3,177
13

Just type the following into command line:

echo %USERNAME%
galoget
  • 403
sYnfo
  • 1,954
10

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

echo %userdomain% %username%
Mike Chess
  • 6,973
7

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)

3

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.

Indrek
  • 24,874
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