echo %USERNAME% is another option...
Steve
Main Topics
Browse All TopicsHi,
1. I read the book which title "Microsoft Windows command-line" by William R.stanek
2. At page 83, It says that there is a command called "whoami"
3. I went to "command prompt" and tried this command (I typed at C:\ whoami),
4. But the message: 'whoami' is not recognized as an internal or external command, operable program or batch file
5. I am using the windows 2000 Server,
6. Somebody can help ?
7. Thanks.
tjie
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi Sajuks, dragon-it and Glen 1984,
1. All solutions are Great !
2. Per Sajuks: It provides "whoami.exe"
3. per dragon-it and Glen 1984: it provides "the user name" and the "whoami.bat"
4. If i compare, the Sajuks's solution is more complete (for Example: the user is John; i) sajuks' s solution will give : DOMAIN\john, ii) but the other 2 solutions only provide: john (without DOMAIN)
5. My other question (for Glen 1984): how to make the whoami.bat which gives the same answer as whoami.exe ?? (with the domain),
6. And, how to make whoami.EXE ? (just adding the EXE extension ?)
7. Thank you.
Tjie
You can get the domain with %userdomain%. Type SET from a command prompt to see what else is available to use in batch files.
i.e.
echo %userdomain%\%username% returns domain\user
The following link is a tiny basic program whoami.exe which does this:
PRINT ENVIRON$("USERDOMAIN") + "\" + ENVIRON$("USERNAME")
http://www.dragon-it.co.uk
or you could just use the resource kit one frankly...
Steve
Business Accounts
Answer for Membership
by: sajuksPosted on 2006-07-06 at 20:44:08ID: 17056022
you need to have the setup for whoami available with you.It is available with your Windows 2000 Resource Kit Tool CD or You can download the application from ownloads/d etails.asp x? familyid =3E89879D- 6C0B-4F92- 96C4-1016C 187D429&di splaylang= en
http://www.microsoft.com/d
and then run it