WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Calculate IP Address Range

 Keywords:  Calculate Get IP Address Addr Range Begin End

ipb   = "199.59.148.0"
ipe   = "199.59.151.245"
ipn   = ipb

ow = FileOpen("ip_list.txt","WRITE")

bpt1 = ItemExtract(1,ipb,".")
bpt2 = ItemExtract(2,ipb,".")
bpt3 = ItemExtract(3,ipb,".")
bpt4 = ItemExtract(4,ipb,".")

ept1 = ItemExtract(1,ipe,".")
ept2 = ItemExtract(2,ipe,".")
ept3 = ItemExtract(3,ipe,".")
ept4 = ItemExtract(4,ipe,".")

  For w = bpt1 To 255
    For x = bpt2 To 255
      For y = bpt3 To 255
        For z = bpt4 To 255
          ipn = w:".":x:".":y:".":z
          FileWrite(ow,ipn)
          BoxText(ipn)
          If ipn == ipe Then
            FileClose(ow)
            Exit
          EndIf
        Next
        If y >= ept3 && x >= ept2 && w >= ept1 Then y = 256
      Next
        If ept2 - bpt2 != 0 Then bpt3 = 0
        If y >= ept3 && x >= ept2 && w >= ept1 Then x = 256
    Next
        If ept1 - bpt1 != 0 Then bpt2 = 0
        If y >= ept3 && x >= ept2 && w >= ept1 Then w = 256
  Next
  FileClose(ow)

Article ID:   W18238
Filename:   Calculate IP Address Range.txt
File Created: 2013:04:26:11:32:06
Last Updated: 2013:04:26:11:32:06