Take the 2-minute tour ×  Is there a Windows equivalent of Unix
"whoami" command? If so, what is it?  share|improve this
question Yes there is and it's also whoami –  DeepSpace101 Sep 1
at 20:45  7 Answers 7  up vote 51 down vote accepted  Since
Windows 2000, the whoami command has been part of the standard
command line (thanks to pk for clearing that up in comments!).
You can do this: Open a command prompt and type "set" then hit
enter. This shows active environment variables. Current logged
on username is stored in the USERNAME env variable and your
domain is stored in the USERDOMAIN variable.  To piggy-back off
the other answers, from a cmd line:   will get you the complete
logged on user in domain\username format.  You can do the same
thing with Powershell with this:  write-host
$env:userdomain\$env:username share|improve this answer +1 for
the educational aspect, and for including the domain as well as
the username –  tomjedrz May 19 '09 at 17:15 @squillman How can
I make this work when running a comman