1

When I issue ipconfig /displaydns, I get a ton of output. I want to display the details for a specific domain name like google.com. My objective is something like this as output:

enter image description here

I tried ipconfig /displaydns | find "google.com", but this did not help me as it only displays the lines, not the section

2 Answers 2

0

Do ipconfig /displaydns > file.txt and use a text editor to find the entry.

5
  • can you please provide me more details on this? Nov 24, 2018 at 9:36
  • Which details ?
    – harrymc
    Nov 24, 2018 at 11:02
  • what do you mean by > file.txt I dont want to copy the result to txt file and search there, totally useless Nov 24, 2018 at 15:07
  • So what are you searching? A script for extracting 8 lines?
    – harrymc
    Nov 24, 2018 at 15:25
  • I want to display a section like display the result of only google.com from ipconfig /displaydns, because there are a lot of entries in the output: ! i.postimg.cc/W4rtpdVW/2018-11-24-22-22-24-Command-Prompt.png Nov 24, 2018 at 18:21
0

I'd recommend PowerShell for this. Open PowerShell and type this command:

Get-DnsClientCache | ? { $_.Entry -eq "google.com" }

You could also search partial matches using the -like operator:

Get-DnsClientCache | ? { $_.Entry -like "*google.com" }

You can use Out-GridView (ogv) to open a pretty GUI window which will let you filter on any field as you type:

Get-DnsClientCache | ogv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.