WHOAMI.exe (Resource kit)

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

WHOAMI /all - shows all permissions and group memberships.

"We can now manipulate images to such an extrodinary extent that there's no lie you cannot tell" - Sir David Attenborough

Related:

SET
- Display, set, or remove Windows environment variables
VER - Display version information
VOL - Display a disk label
Whereami.cmd - Display user information
Powershell: "env:userdomain" "env:username"
Equivalent bash command (Linux): whoami - Print the current user id and name (`id -un')



Back to the Top

Simon Sheppard
SS64.com