I'm new here, and I'm not familiar with some problems and commands yet. I hope the experts can give me some pointers.. thanks
I need to find out my own IP, then based on that IP, find the corresponding server address from a data text file.
And it has to be set automatically....
Here is my line of thought, and the part I can't figure out:
There is a data address for an IP stored in a document.. the format is as follows:
10.248.52.63 10.248.31.15 ......
10.248.52.64 10.248.31.16 ......
10.248.52.65 10.248.31.16 ......
10.248.52.166 10.248.31.16 ......
10.248.52.67 10.248.31.32 ......
10.248.52.168 10.248.31.32 ......
10.248.52.69 10.248.31.32 ......
10.248.52.170 10.248.31.33 ......
Then get my own IP and save it into the myip.txt document
for /f "tokens=15" %%i in ('ipconfig ^| find /i "ip address"'
do set ip=%%i
echo Your IP is:%ip%
( find "%ip%" < icdconfig.txt ) >myip.txt ::
After that there is one line of data in myip.txt, such as:
10.248.52.63 10.248.31.15 ......
These data were converted from EXCLE. The ".........." at the back are the remaining several server IP addresses... the two IP addresses are separated by a Tab.
What I need is to get the last segment of 10.248.31.15 in this IP (the number 15)
and store it in a variable for later use
The problem is here: how can I get the number 15 and store it into a variable
for me to call again?
I tried using for and findstr, but neither can specify this position.......
Please help me.....
[ Last edited by andison625 on 2008-6-1 at 09:52 AM ]
I need to find out my own IP, then based on that IP, find the corresponding server address from a data text file.
And it has to be set automatically....
Here is my line of thought, and the part I can't figure out:
There is a data address for an IP stored in a document.. the format is as follows:
10.248.52.63 10.248.31.15 ......
10.248.52.64 10.248.31.16 ......
10.248.52.65 10.248.31.16 ......
10.248.52.166 10.248.31.16 ......
10.248.52.67 10.248.31.32 ......
10.248.52.168 10.248.31.32 ......
10.248.52.69 10.248.31.32 ......
10.248.52.170 10.248.31.33 ......
Then get my own IP and save it into the myip.txt document
for /f "tokens=15" %%i in ('ipconfig ^| find /i "ip address"'
do set ip=%%iecho Your IP is:%ip%
( find "%ip%" < icdconfig.txt ) >myip.txt ::
After that there is one line of data in myip.txt, such as:
10.248.52.63 10.248.31.15 ......
These data were converted from EXCLE. The ".........." at the back are the remaining several server IP addresses... the two IP addresses are separated by a Tab.
What I need is to get the last segment of 10.248.31.15 in this IP (the number 15)
and store it in a variable for later use
The problem is here: how can I get the number 15 and store it into a variable
for me to call again?
I tried using for and findstr, but neither can specify this position.......
Please help me.....

[ Last edited by andison625 on 2008-6-1 at 09:52 AM ]
