The dig command is an essential DNS troubleshooting tool on Linux and macOS. However, attempting to use it in a Windows Command Prompt or PowerShell will return the errors as follows:
‘dig’ is not recognized as an internal or external command, operable program or batch file.
—
dig : The term ‘dig’ 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.
The Windows dig equivalent are the Resolve-DnsName command in PowerShell and the nslookup command in Command Prompt.
Below is a quick guide on how to use these commands to check DNS records in Windows.
‘Dig’ vs ‘Resolve-DnsName’ vs ‘Nslookup’
‘A’ records show the IP address linked to a domain name. Use this to find out which server is hosting a website.
Resolve A records
Linux/macOS Shell:
$ dig shellhacks.com A
Windows PowerShell:
PS C:\> Resolve-DnsName -Name shellhacks.com -Type A
Windows Command Prompt:
C:\> nslookup -type=A shellhacks.com
Resolve MX records
‘MX’ records are for emails. They show which mail servers handle emails for a domain. This helps if there are email problems or you need to check the setup.
Linux/macOS Shell:
$ dig shellhacks.com MX
Windows PowerShell:
PS C:\> Resolve-DnsName -Name shellhacks.com -Type MX
Windows Command Prompt:
C:\> nslookup -type=MX shellhacks.com
Resolve all DNS records
If you want to check all the DNS details for a domain, resolving all DNS records is the way to go. This gives you a full picture, including different types like ‘A’, ‘MX’, and ‘AAAA’ records.
Linux/macOS Shell:
$ dig shellhacks.com any
Windows PowerShell:
PS C:\> Resolve-DnsName -Name shellhacks.com -Type any
Windows Command Prompt:
C:\> nslookup -type=any shellhacks.com
Conclusion
For users searching for a Windows dig equivalent, Resolve-DnsName and nslookup are the best alternatives. While Resolve-DnsName offers more comprehensive details, nslookup is simpler and more widely available. For more guidance on Windows alternatives, see our guides on the Windows “cat” command equivalent and Windows “grep” command equivalent.