I want to fetch IP address, subnet, gateway and DNS servers from ipconfig and store in a variable using bash script. I have created below script but it is not fetching dns servers(below XXXX and YYYY) in separate variables.
`DNS Servers . . . . . . . . . . . : XXXX
YYYY`
echo IPAddress is:
for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "IPv4"') do set ip=%%b
set ip=%ip:~1%
echo %ip%for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "Subnet"') do set sub=%%b
set sub=%sub:~1%
echo Subnet is:
echo %sub%for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "Default"') do set gate=%%b
set gate=%gate:~1%
echo Gateway is:
echo %gate%