Solved

Command: WHOAMI ?

Posted on 2006-07-06
5
3,029 Views
Last Modified: 2010-08-05
Hi,

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
0
Comment
Question by:tjie
5 Comments
 
LVL 33

Assisted Solution

by:sajuks
sajuks earned 125 total points
ID: 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
http://www.microsoft.com/downloads/details.aspx?familyid=3E89879D-6C0B-4F92-96C4-1016C187D429&displaylang=en
and then run it
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 250 total points
ID: 17057083
echo %USERNAME% is another option...

Steve
0
 
LVL 16

Assisted Solution

by:glenn_1984
glenn_1984 earned 125 total points
ID: 17058416
Or create a batch file:

whoami.bat
with one line in the file
echo %USERNAME%
0
 

Author Comment

by:tjie
ID: 17063800
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
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 250 total points
ID: 17064117
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/files/whoami.exe

or you could just use the resource kit one frankly...

Steve
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
With the rapid rise in mobile usage, mobile devices are here to stay and have become an integral part of doing business. Here are 9 great apps for your BYOD environment.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now