GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • SS64
  • CMD
  • How-to

This view

  • Original page
  • New address

GeezerVison is showing ss64.com — Hostname command - Windows CMD

  • SS64
  • CMD
  • How-to

HOSTNAME.exe

Display the host name portion of the full computer name of the computer.

Syntax
      HOSTNAME

Options

   /?    Display Help

The hostname command is only available if the Internet Protocol (TCP/IP) is installed as a network component.

The computer hostname is usually (but not always) the same as the %COMPUTERNAME% variable.

When called with any argument other than /? hostname sets errorlevel to 1 and prints an error message.

If the environment variable _CLUSTER_NETWORK_NAME_ exists and is populated, then HOSTNAME will return the value of that variable in place of the true Hostname.

Examples

Display the system hostname:

C:\> hostname

“There’s a little bit of magic in everything, and some loss to even things out” ~ Lou Reed

Related commands

echo %computername%
Equivalent PowerShell cmdlet: $env:COMPUTERNAME
Equivalent bash command: hostname


 
Copyright © 1999-2026 SS64.com
Some rights reserved
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.