Узнать текущего пользователя windows cmd

The answer depends on which «command-line script» language you are in.

Cmd

In the old cmd.exe command prompt or in a .bat or .cmd script, you can use the following:

%USERNAME% — Gets just the username.

%USERDOMAIN% — Gets the user’s domain.

PowerShell

In the PowerShell command prompt or a .ps1 or .psm1 script, you can use the following:

[System.Security.Principal.WindowsIdentity]::GetCurrent().Name — Gives you the fully qualified username (e.g. Domain\Username). This is also the most secure method because it cannot be overridden by the user like the other $Env variables below.

$Env:Username — Gets just the username.

$Env:UserDomain — Gets the user’s domain.

$Env:ComputerName — Gets the name of the computer.

Any Shell

whoami — Gets the user’s domain and username in the format «domain\username».

This also works on Unix systems as well, not just Windows, so it’s a nice cross-platform solution.

The answer depends on which «command-line script» language you are in.

Cmd

In the old cmd.exe command prompt or in a .bat or .cmd script, you can use the following:

%USERNAME% — Gets just the username.

%USERDOMAIN% — Gets the user’s domain.

PowerShell

In the PowerShell command prompt or a .ps1 or .psm1 script, you can use the following:

[System.Security.Principal.WindowsIdentity]::GetCurrent().Name — Gives you the fully qualified username (e.g. Domain\Username). This is also the most secure method because it cannot be overridden by the user like the other $Env variables below.

$Env:Username — Gets just the username.

$Env:UserDomain — Gets the user’s domain.

$Env:ComputerName — Gets the name of the computer.

Any Shell

whoami — Gets the user’s domain and username in the format «domain\username».

This also works on Unix systems as well, not just Windows, so it’s a nice cross-platform solution.

One of the easiest ways to find your username is your login screen. Once you start your computer, you’ll see your username appear right at the beginning on top of the password box.

But, if you don’t want to restart your system just to find your username, then read along.

We’ve listed 8 other easy ways to find your username, regardless of the version you are using!

Use the echo command

In computing, the echo command is used to display its arguments on the standard output. We can use this feature to display our username.

  1. Press Win + R to open the run dialog box.
  2. Type cmd in the box next to open, and press enter.find your windows username with Command Prompt
  3. Type echo %USERNAME% and press enter.Type echo %USERNAME% and press enter
  4. Your username will appear in the next line

Use the whoami command

There is also another way to find your username from the command prompt. You simply need to type out another set of instructions.

  1. Press Win + R to open the run dialog box.
  2. Type cmd in the box next to open, and press enter.
  3. Type whoami and press enter.find your windows username by Running whoami command
  4. Your username will appear in the next line

Find your username from the Task Manager

In the task manager, there is a tab called users from where you can find your username.

  1. Press Ctrl + Shift + Esc to open task manager.
  2. If it appears in compact view, click on the arrow next to more details.Open task manager
  3. Go to the users tab.
  4. If you are a single user, only your username will be shown.
  5. If there are multiple accounts, your username will be at the top. find your username in task manager

Run the Netplwiz command

The Netplwiz.exe is a part of the Microsoft Windows Operating System. It is like an advanced version of the user accounts control panel.  You can use this to view and also change your username.

  1. In the search bar, type Netplwiz.
  2. From the dialog box that opens, click on properties.Go to Neptlwiz data-lazy-srcset= properties”>
  3. Your windows username will be displayed and highlighted.Your username will be highlighted

Open the control panel

You can also find your username from the control panel.

  1. Press Windows + R to open the run dialog box.
  2. Type Control and press enter.
  3. Go to User Accounts. Go to control panel data-lazy-srcset= user accounts”>
  4. Press on User Accounts again. Your username will appear right next to your display picture.Your username will be next to your display picture.

Go to the Account Information center

The account information center is where you can find all the details about your user account, from your display picture, password, and obviously, your username.

  1. Press Ctrl + I to open settings. Go to Accounts.Go to windows settings data-lazy-srcset= Accounts”>
  2. Click on Your Info
  3. Your username will be displayed in bold below the profile pictureYour username is in bold

View your username from the start window

You can actually see your username by clicking on the start icon of your screen. However, if your PC is updated to the latest version, you might have to add a couple more steps.

  1. Click on the start button from your desktop.
  2. Hover on the profile picture at the left panel.Go to start and hover on your profile picture
  3. Your username will appear there.

And there you have it! We hope you were able to find what your username on Windows is.

Содержание

  • Как узнать имя пользователя
    • Способ 1: «Командная строка»
    • Способ 2: Панель управления
  • Вопросы и ответы

как узнать имя пользователя компьютера на windows 10
Многие пользователи практикуют использование нескольких учётных записей на одном компьютере – например, в целях родительского контроля. Если аккаунтов много, может возникнуть путаница, поскольку не сразу понятно, под каким из них загружена система. Решить этот вопрос можно просмотром имени текущего пользователя, и сегодня мы хотим вас познакомить с методами совершения этой операции.

Как узнать имя пользователя

В более старых вариантах Виндовс псевдоним учётной записи отображался при вызове меню «Пуск», но разработчики отказались от этого в версии «окон» начиная с 8. В сборках «десятки» до 1803 эта возможность вернулась – имя можно было посмотреть через дополнительное меню «Пуска», доступное по нажатию кнопки с тремя полосками. Однако в 1803 и выше это убрали, и в новейшей сборке Windows 10 доступны иные варианты просмотра имени пользователя, приведём самые простые.

Способ 1: «Командная строка»

Множество манипуляций с системой можно совершить с помощью «Командной строки», в том числе и необходимую нам сегодня.

  1. Откройте «Поиск» и начните набирать словосочетание командная строка. В меню отобразиться нужное приложение – кликните по нему.
  2. Открыть командную строку чтобы узнать имя пользователя компьютера Windows 10

  3. После открытия интерфейса ввода команд укажите в нем следующий оператор и нажмите Enter:

    net user

  4. Ввести оператор чтобы узнать имя пользователя компьютера Windows 10

  5. Команда выведет на экран список всех учётных записей, созданных на этой системе.

Список имён пользователей компьютера Windows 10 в Командной строке

К сожалению, никакого выделения текущего пользователя не предусмотрено, поэтому этот способ подходит только для компьютеров с 1-2 учётными записями.

Способ 2: Панель управления

Второй метод, с помощью которого можно узнать имя пользователя – инструмент «Панель управления».

  1. Откройте «Поиск», наберите в строке панель управления и кликните по результату.
  2. Открыть панель управления, чтобы узнать имя пользователя компьютера Windows 10

  3. Режим отображения значков переключите в «Крупные» и воспользуйтесь пунктом «Учётные записи пользователей».
  4. Вызвать список учётных записей, чтобы узнать имя пользователя компьютера Windows 10

  5. Щёлкните по ссылке «Управление другой учётной записью».
  6. Управление учётными записями, чтобы узнать имя пользователя компьютера Windows 10

  7. Откроется окно, в котором можно просмотреть все учётные записи, существующие на этом компьютере – справа от аватаров каждой из них можно увидеть имена.
  8. Имя пользователя компьютера Windows 10 в Панели управления

    Такой способ удобнее, чем задействование «Командной строки», поскольку применять его можно на любой учётной записи, и информацию указанная оснастка отображает более наглядно.

Мы рассмотрели способы, которыми можно узнать имя пользователя компьютера на Windows 10.

Еще статьи по данной теме:

Помогла ли Вам статья?

on October 28, 2010

In Windows OS, we can find the current logged in username from windows command line. The logged in user information is stored in environment variables. So just by printing the value in these environment variables we can get to know the login name.

To know the login name of the currently logged in user we can run the below command.

echo %username%

This works on all releases of Windows OS(Windows XP, Server 2003, Windows Vista and Windows 7).

There is another command whoami which tells us the domain name also.

whoami

Example:

c:\>whoami
cmdline\administrator

Both of these options to find user name can be useful in batch files to write code in such a way that it works for every user. For example, if your batch file need to access a user specific folder, say Application data, then you can refer the directory as ‘C:\users\%username%\appdata‘.

  • Узнать сколько бит в системе компьютера с windows 10
  • Удалить экран приветствия в windows 10
  • Узнать время последней перезагрузки windows
  • Узел службы сетевая служба грузит диск windows 10
  • Удаляются ли данные при обновлении до windows 10