Please see below ipconfig output in windows.
C:>ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection 11:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::4149:4c25:692d:dfec%91
IPv4 Address. . . . . . . . . . . : 10.252.26.84
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Wireless LAN adapter Wireless Network Connection 15:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Local Area Connection 10:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Wireless Network Connection 14:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::79a2:afc8:7cd0:79ac%72
IPv4 Address. . . . . . . . . . . : 192.168.10.9
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.10.1
I want to find the Default Gateway for Wireless Network Connection 14 in a bat file then store that in a varient to use later
I understand I can "findstr" but I have no idea how to get the default gateway of that NIC.
Thanks!
This should get it:
Verify the interface name with:
and try something like this:
Try something along the lines of:
You should then be able to use %DefaultGateway% as a variable.
Source