WHOIS Command on Windows – PowerShell & CMD

In Linux, a whois command is used to lookup information about domains or IP addresses.

But if you try to run the whois command on Windows from PowerShell or command prompt (CMD), you will receive one of the errors below:

‘whois’ is not recognized as an internal or external command,
operable program or batch file.
– or –
whois : The term ‘whois’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

This post shows how to install the whois command on Windows and make it available in PowerShell and CMD.

Cool Tip: How to Ping an IPv6 Address in Windows! Read more →

Windows WHOIS Command in PowerShell & CMD

By default, the whois command is not installed on Windows, nevertheless there is no need to search for any equivalents as the whois command can be downloaded and installed from the official Microsoft website.

To install the whois command on Windows, download the WhoIs.zip archive and unzip it.

At this point you can already run the whois command from Powershell or CMD by specifying a path to the executable or by navigating to a folder with the extracted files:

PS C:\> .\Users\UserName\Downloads\WhoIs\whois.exe shellhacks.com
- or -
PS C:\> cd .\Users\UserName\Downloads\WhoIs\
PS C:\Users\UserName\Downloads\WhoIs> .\whois.exe shellhacks.com

To facilitate a usage of the whois command in Powershell and CMD by making it available from any location, you can move the executable file to a folder that is already in %PATH% or add the folder with whois.exe to %PATH%.

Open a user’s home folder by typing %USERPROFILE% in the address bar of a “File Explorer”:

In the user’s home create a bin folder and move the whois.exe there:

Start the environment variables editor – press the ⊞ Win keybutton to open the “Start” menu, type in envi and click on “Edit environment variables for your account”.

The environment variables editor can also be launched with the following command from CMD or PowerShell:

C:\> rundll32 sysdm.cpl,EditEnvironmentVariables

Add the bin folder to a Path environment variable:

After adding to %PATH%, the whois command can be executed in PowerShell or CMD from any location:

C:\> whois
- or -
PS C:\> whois
- sample output -
Whois v1.21 - Domain information lookup
Copyright (C) 2005-2019 Mark Russinovich
Sysinternals - www.sysinternals.com

Usage: whois [-v] domainname [whois.server]
 -v   Print whois information for referrals
 -nobanner
      Do not display the startup banner and copyright message.

As an alternative to installing the whois command on Windows, you can use any of various WHOIS services online, like https://lookup.icann.org/.

Was it useful? Share this post with the world!

Leave a Reply