?
Solved

Command: WHOAMI ?

Posted on 2006-07-06
5
Medium Priority
?
3,259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 33

Assisted Solution

by:sajuks
sajuks earned 500 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 1000 total points
ID: 17057083
echo %USERNAME% is another option...

Steve
0
 
LVL 16

Assisted Solution

by:glenn_1984
glenn_1984 earned 500 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 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 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