11

I have a machine running Windows 7 which I set up a long time ago to autmatically log into Windows.

That's still working fine, but how can I work out the username of the currently logged-in user when I'm sat at the desktop?

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
Jon Cage
  • 2,499
  • 11
  • 38
  • 47

5 Answers5

14

From a cmd window run:

echo %USERNAME%
DMA57361
  • 18,562
  • 7
  • 72
  • 96
  • 6
    A better option is typing "whoami" This gives a fully qualified username instaed of just the folder they are working out of :). – Jeff F. Jan 11 '11 at 14:08
  • @Jeff sounds handy, but I was (and currently am) on a WinXP box, and `whoami` doesn't seem to be available. If that actually works you should put it down as an answer. – DMA57361 Jan 11 '11 at 14:17
  • Correct, Vista or later :) returns like CoolDomain\Jeff or AmazingComputer\Jeff – Jeff F. Jan 11 '11 at 14:24
  • @Jeff, indeed it does (now I'm back home on my nice warm Win7 box :), in fact it's a better way of doing it than my current answer (because what prevents some odd call to `set` changing the env variable?) - stick that in an answer and you can have a +1 from me (obviously, feel free to @ me if you do post it). – DMA57361 Jan 11 '11 at 20:28
  • Thanks, I'll toss it in an answer so others see it later. – Jeff F. Jan 11 '11 at 20:55
9
  1. Press the Win+R at the same time
  2. Type cmd and click OK
  3. Type whoami then press Enter

This will return the fully qualified user name.

I say Reinstate Monica
  • 25,487
  • 19
  • 95
  • 131
Jeff F.
  • 4,413
  • 1
  • 20
  • 43
8

Open task manager and go to Users tab , it will display which login is being used currently.

enter image description here

Matthew Lock
  • 4,671
  • 2
  • 35
  • 44
Shekhar
  • 5,009
  • 4
  • 33
  • 49
1

Run (WinKey+R) > cmd /c "echo %username% & pause"

Fastest, easiest way to do it.

EDIT: Changed run command. Was ECHO %USERNAME%| PAUSE. Did not work due to echo being an internal command of cmd.exe.

Doug A.K.
  • 610
  • 4
  • 7
  • -1: Doesn't seem to work for me; it comes up asking what program I want to open 'ECHO' with. – Jon Cage Jan 07 '11 at 15:25
  • Whoops! Forgot that `ECHO` is an internal command and I didn't test it! This works though, I tested it on my Windows 7 box: `cmd /c "echo %username% & pause"` – Doug A.K. Jan 07 '11 at 15:36
  • Edit your answer with that and I'll remove the vote-down. FYI, you can do `/k` instead of `/c` and omit the pause. – Jon Cage Jan 11 '11 at 13:59
-3

Click the Start button. Your username is on the right hand section of the start menu, under the picture at the top.

seanyboy
  • 1,688
  • 1
  • 14
  • 14