I want a specific IP range

vinitwins

Contributor
I want to check the IP of my pppoe connection and if it is NOT of a particular IP range i want to execute a batch file.

i've figured out a rudimentary way of checking the IP address by executing 'ipconfig > c:\iptest.txt'

This generates a text file with the IPs of all my adapters.

Now is there any way I can check whether line 22, characters 53, 54, 55 are equal to 1, 8 and 5 respectively and if NOT to execute a batch file...?

Any help/suggestions to automate this process would be appreciated.
 
this bat file is executed everytime my dialer connects to the net to check for a particular IP range... I need help completing the missing commands

:begin
ipconfig > c:\ipcheck1.txt
find /c ".185." c:\ipcheck1.txt
if output for above command is true goto end (output will be "---------- C:\IPCHECK1.TXT: 1")
rem I need to correct syntax for the line above
C:\PROGRA~1\NIRCMD\nircmd.exe rashangup "7NETSRV6"
rem my dialer will auto connect on disconnect
goto begin
:end

thanks,
vin
 
Final batch file - also needs cidial (auto dialer), nircmd.exe (for RAS command line disconnect) & choice.com (to introduce wait in batch files)

:begin
ipconfig > c:\ipcheck1.txt
find/c ".185." c:\ipcheck1.txt
if not errorlevel=1 goto end
C:\PROGRA~1\NIRCMD\nircmd.exe rashangup "7NETSRV6"
rem my dialer will auto connect on disconnect
CHOICE.COM /N /CY /TY,5
goto begin

:end
 
Back
Top