How to find the computer name using command prompt?

You can find the computer name of a Windows 11 computer through the command prompt. The command prompt approach is simpler and more accessible than going through the Settings tab of computer properties.

Below, we look at three ways you can find the computer name using the command prompt on a Windows 11 computer. Before discussing both ways, we will like to reiterate that you can launch the command prompt in Windows 11 by using the ‘cmd’ command in the search box or in the ‘Run’ dialog box.

Command prompt on Windows 11 computer

You will need to run ‘cmd’ or command prompt as administrator. So, please do ensure that ‘Run as administrator’ is selected to launch command prompt session with administrative privileges.

WMIC command to get computer name in command prompt

The first approach to finding the computer name of a Windows 11 computer is through the wmic command. The WMIC command is available in the command prompt as well as in the Powershell environment. It is one of the simplest ways by which you can fetch system details, including the computer’s name.

Use the following wmic command to find the computer name through the command prompt on a Windows 11 computer.

wmic computersystem get name

The output of this command is presented below in the form of a screenshot. The device name for this Windows 11 computer is SYSTEM-02 and the same is shared as the command output below.

Computer name using wmic command on the Windows 11 command prompt

Find the computer name using hostname command in Windows 11

Another simple approach to finding the computer name of a Windows 11 or Windows 11 computer is through the hostname command. On the command prompt, type the ‘hostname’ command to get the computer name displayed on the screen.

hostname

The output of this command is represented below in the screenshot. You can see the output contains the name of the computer, SYSTEM-02.

hostname command to get computer name in Windows 11

You can also redirect the command output of the wmic or hostname command to a static file. So, for example, if you wish to store computer names in a static text file computer-names.txt file, we will alter the wmic command and the hostname command as per the below instructions:

  • wmic computersystem get name > c:\computer names\computer-names.txt
  • hostname > c:\computer names\computer-names.txt

Find the computer name using ipconfig command on Windows 11 computer

You can use the ipconfig /all command to find the system name or computer name on a Windows 11 computer. The output of this command is shared below in the screenshot. You will need to type this command on the command prompt on a Windows 11 computer.

Under the Windows IP Configuration section, you can see that the Host Name data corresponds to the computer name of a Windows 11 or Windows 10 computer.

ipconfig /all command to find host name of the computer or computer name on a Windows 11 system.

Summary

In this Windows 11 tutorial, we have seen three different ways by which we can find the computer name of a Windows 11 computer. We can use any of the following commands to fetch computer name of a Windows 11 computer from the command prompt:

  • wmic command
  • hostname command
  • ipconfig /all command

Agreeably, the command prompt offers the fastest way to figure out computer information on a Windows 11 system.

Rajesh Dhawan

Rajesh Dhawan is a technology professional who loves to write about Cyber-security events and stories, Cloud computing and Microsoft technologies. He loves to break complex problems into manageable chunks of meaningful information.