Batch: If the IP is in the IP range

Results 1 to 4 of 4
  1. #1
    Be a kicker than cheater. cheaterastic is offline
    True MemberRank
    Dec 2009 Join Date
    746Posts

    Batch: If the IP is in the IP range

    Batch: If the IP is in the IP range
    I don't know how to make a code lines for checking "if an IP Address is in the IP range"

    I know it might need VBS (file) language or something, please help me.

    This is the example of IP range (IP/mask):
    162.158.0.0/15
    Last edited by cheaterastic; 15-11-18 at 01:06 PM.


  2. #2
    Hardcore Member treebeard is offline
    MemberRank
    Jun 2018 Join Date
    Middle EarthLocation
    104Posts

    Re: Batch: If the IP is in the IP range

    Quote Originally Posted by cheaterastic View Post
    I don't know how to make a code lines for checking if IP is in the IP range

    I know it need VBS file/code, please help me.

    This is the example of IP range (IP/mask):
    162.158.0.0/15
    You could use an enum to declare reserved IP's such as 127.0.0.1 and 000.000.000 etc.
    Then you could read the IP you need to check as a string, split it around "." and stick the segments into an array, then check that each part is between 0 and 255 as those are the valid values of an IPv4 address.
    Obviously this is a very generic way to solve the problem and many languages like Java and C# will have built in tools for this that may prove to be easier.

  3. #3
    Be a kicker than cheater. cheaterastic is offline
    True MemberRank
    Dec 2009 Join Date
    746Posts

    Re: Batch: If the IP is in the IP range

    Yeah thanks, that's what I did.

  4. #4
    Hardcore Member treebeard is offline
    MemberRank
    Jun 2018 Join Date
    Middle EarthLocation
    104Posts

    Re: Batch: If the IP is in the IP range

    Quote Originally Posted by cheaterastic View Post
    Yeah thanks, that's what I did.
    No problem.

    Feel free to tag me in other programming related questions or send me a dm!



Advertisement