I’m using cmd to print the users network spec in to a text file using ipconfig > computer.txt. An Example of this would be
Windows IP Configuration
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::cd7a:50b3:1284:865%12
IPv4 Address. . . . . . . . . . . : 10.0.0.26
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . : 10.0.0.1
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::5c3a:ae77:81:8cdf%11
IPv4 Address. . . . . . . . . . . : 10.0.0.25
Subnet Mask . . . . . . . . . . . : 255.255.255.0
IPv4 Address. . . . . . . . . . . : 192.168.1.12
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.0.1
How would I use this to find one of the adapters default gateway( x lines down and after then:
Not sure if this is right way of doing it.
If not, what is the best way to find the subnet mask/default gateway using vb.net
If the format is always the same
String.IndexOfandString.Substringare effcient ways:You can use
Enumerable.Skipto skip x-lines, in this example 10.