24

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,421
  • 5
  • 18
  • 38
Mark
  • 3,149
  • 9
  • 36
  • 39
  • Related: *[How can I work out which user is currently logged into a Windows 7 machine?](https://superuser.com/questions/230216)* – Peter Mortensen Jun 19 '17 at 14:27

6 Answers6

23

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

echo %userdomain%
echo %username%
galoget
  • 393
  • 2
  • 10
Mark
  • 3,149
  • 9
  • 36
  • 39
13

Just type the following into command line:

echo %USERNAME%
galoget
  • 393
  • 2
  • 10
sYnfo
  • 1,952
  • 1
  • 11
  • 14
10

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

echo %userdomain% %username%
Mike Chess
  • 6,413
  • 2
  • 19
  • 18
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)

Richard Lucas
  • 2,838
  • 21
  • 23
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,204
  • 14
  • 90
  • 93
Andy Coyle
  • 41
  • 1
  • 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