Perl script to run ipconfig command command prompt, fetch the ip address assign to specific network interface and add a route in command prompt for this ip?

i have 3 NIC card connected to windows PC.

IP of one NIC card is getting ip from DHCP, so ip is changing when ever i m rebooting.

i have to add a route for this IP in command prompt.

So need a perl script to add a route for this new ip through script.

IPCONFIG output is like this

Ethernet adapter Local Area Connection 2:</P> <p> Connection-specific DNS Suffix . : </P> <p> IP Address. . . . . . . . . . . . : 135.250.192.101</P> <p> Subnet Mask . . . . . . . . . . . : 255.255.255.0</P> <p> IP Address. . . . . . . . . . . .fe80::200:21ff:fe5c:8629%4</P> <p> Default Gateway . . . . . . . . . : 125.250.192.254</P> <p>Ethernet adapter Local Area Connection:</P> <p> Connection-specific DNS Suffix . : </P> <p> IP Address. . . . . . . . . . . . : 172.1.2.13</P> <p> Subnet Mask . . . . . . . . . . . : 255.255.255.0</P> <p> IP Address. . . . . . . . . . . .fe80::221:9bff:feea:b45c%5</P>

the route command is like this

add route 192.168.254.2 mask 255.255.255.255 <IP of Ethernet adapter L +ocal Area Connection>

In reply to Perl script to run ipconfig command command prompt, fetch the ip address assign to specific network interface and add a route in command prompt for this ip? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.