Solved

Command: WHOAMI ?

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server Hard Drive Expansion 2 158
Syteline and a new domain controller 4 728
OLD CPUs 12 94
reboot server with scheduled time and week base 4 34
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 User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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