Solved

Command: WHOAMI ?

Posted on 2006-07-06
5
3,143 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 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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
kerberos errors 7 556
Cursed with a Windows 2000 Server that needs to copy files 3 731
win2k service packs 5 663
Building AD from Scratch 5 145
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…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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