Displays the username and domain for the currently logged in user.
The whoami output is the same as the 2 environment variables %USERDOMAIN% and %USERNAME%.
So the same output can usually be achieved with
ECHO %USERDOMAIN%\%USERNAME%
One exception to this is when using RUNAS /env , e.g. if my username is Simon:
c:>RunAs /env /user:JDoe cmd.exe
c:>ECHO %USERDOMAIN%\%USERNAME%
ss64\Simon
c:>whoami
ss64\JDoe
Under Windows 2000 there is an additional switch WHOAMI /all - this shows all permissions and group memberships.