I am trying to get the first DNS server for a specific adapter.
Running: netsh interface ip show dnsservers name="local area connection" gives me the DNS server information for the "local area connection" adapter.
To that end I created the below (which works fine):
@echo onFOR /F "skip=1 tokens=6" %%j in ('netsh interface ip show dnsservers^| findstr /i /c:"DNS Servers"') DO Set DNS=%%j echo %DNS%
But when running it against a specific adapter it fails. Code below:
@echo onFOR /F "skip=1 tokens=6" %%j in ('netsh interface ip show dnsservers name="local area connection"^| findstr /i /c:"DNS Servers"') DO Set DNS=%%j echo %DNS%
Does anyone have an idea whats causing the issue?