I've gotten as far as storing the output of ipconfig in a variable but I don't know how to "grep" it out of all the ouput since I'm not good with RegEx and then store that string into a variable which will be called upon later.
C:\Documents and Settings\bran>ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : domain.net
IP Address. . . . . . . . . . . . : 10.6.16.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.6.16.1
Ethernet adapter Local Area Connection 2:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.42.24
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.42.129
The IP address that I would like to be able to grab is that of Ethernet adapter Local Area Connection 2, the first three octets are always the same (192.168.42) it is only the last octet that changes.
So in short I would like something along the lines of this:
$ip=ipconfig echo $ip [grab IP address and store it in a variable] forcebindip $ipaddress c:\program.exe
or for those of you that understand shell scripting
ipconfig | grep "192.168.42"| head -n1| cut -c 30 > $ip forcebindip $ip c:\program.exe
This post has been edited by Brando569: 13 December 2012 - 10:57 AM



Help

Back to top










