How to determine logged on user in Windows XP?

20

4

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.

Mark

Posted 2009-10-13T19:33:01.980

Reputation: 3 009

Related: How can I work out which user is currently logged into a Windows 7 machine?

– Peter Mortensen – 2017-06-19T14:27:14.043

Answers

21

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

echo %userdomain%
echo %username%

Mark

Posted 2009-10-13T19:33:01.980

Reputation: 3 009

11

Just type the following into command line:

echo %USERNAME%

sYnfo

Posted 2009-10-13T19:33:01.980

Reputation: 1 902

Damn, few second. :D – sYnfo – 2009-10-13T19:41:24.287

You deserve a +1 anyway ;-) – Ivo Flipse – 2009-10-13T19:43:24.987

2I stated in the question that I was looking for something that included the domain as well as the username. – Mark – 2009-10-14T15:52:58.423

10

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

echo %userdomain% %username%

Mike Chess

Posted 2009-10-13T19:33:01.980

Reputation: 5 583

1Or echo %userdomain%\%username% for down-level logon name format. – mythofechelon – 2015-05-27T10:20:47.110

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

Posted 2009-10-13T19:33:01.980

Reputation: 2 744

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

user696300

Posted 2009-10-13T19:33:01.980

Reputation:

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.

Andy Coyle

Posted 2009-10-13T19:33:01.980

Reputation: 21

1You need to explain in detail how to get the wealth of information you talk about. This easily could have been a comment. – Ramhound – 2012-08-29T12:26:10.180

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 – 2012-08-29T16:16:58.210