So far I've been using the ping command to ping a domain name, and if it succeeds, I assume that DNS is working. But I've realised that this might just use the local machine's DNS cache without actually testing the DNS server.
I thought the solution might be to use nslookup instead of ping, but... would that just end up checking the DNS cache on the router without actually testing the DNS server...?
At the moment, my ping command looks like this:
Code: Select all
ping -n 1 -w %PingTimeout% %DomainName% | find "TTL=" >nul
if errorlevel 1 (
REM DNS is down
...
)
Ideally I'd like the code to work with any language settings... if that's possible...
Can anyone suggest how I could improve upon my code?