I'm using nslookup and findstr in a simple batch script to check if a website is up.
However findstr keeps printing lines which doesn't contain any matches.
The command goes like this:
nslookup goofdedwsgle.com | findstr /X /C:"Non-existent domain"
which results in
*** one.one.one.one can't find goofdedwsgle.com: Non-existent domain
Which is what I'm looking for. However if I use an existent domain:
nslookup google.com 1.1.1.1 | findstr /X /C:"Non-existent domain"
I get this which is definitely not a match:
Non-authoritative answer:
It seems this is from the full nslookup output:
Server: one.one.one.one
Address: 1.1.1.1
Non-authoritative answer:
Name: google.com
Addresses: 2404:6800:4004:80a::200e
142.250.66.78
but why does findstr print out that line? /X should guarantee findstr only print out matches right?
Even weirder, if I make a txt file with that same content as the nslookup result, then run findstr /X /C:"Non-existent domain" on that, it shows up empty.
What is the issue here?