[Help] Modifications in a batch file

Page 1 of 2 12 LastLast

  1. Posts : 6
    Windows Seven
       #1

    [Help] Modifications in a batch file


    ipconfig /release
    netsh interface ip set address offboard static 111.111.111.111 255.0.0.0
    netsh interface ip set address offboard dhcp
    ipconfig /renew
    Anyone could help me to make this a working file at Windows Seven?
    I used it on XP to change my IP until now, but when I try to run now it doesn't work
    Obs: Offboard is the name of the connection
      My Computer


  2. Posts : 4,364
    Windows 11 21H2 Current build
       #2

    Try this:

    Code:
     	
    ipconfig /release
    netsh interface ip set address "Offboard" static 111.111.111.111 255.0.0.0
    netsh interface ip set address "Offboard" dhcp
    ipconfig /renew
    Of course it might work without the quotation marks, but if the name is Offboard then you'll need it capitalized correctly for it to work, IIRC.

    Also, the help info in the command shows some other options as well that you might want ot take a look at - in *particular* if the OS is still *internally* recognizing the connection as "Local Area Connection":

    Code:
    C:\>netsh interface ip set address -?
    
    Usage: set address [name=]<string>
                 [[source=]dhcp|static]
                 [[address=]<IPv4 address>[/<integer>] [[mask=]<IPv4 mask>]
                 [[gateway=]<IPv4 address>|none [gwmetric=]<integer>]
                 [[type=]unicast|anycast]
                 [[subinterface=]<string>]
                 [[store=]active|persistent]
    
    Parameters:
    
           Tag            Value
           name         - Interface name or index.
           source       - One of the following values:
                          dhcp: Enables DHCP for configuring IP addresses for
                                the specified interface.
                          static: Disables DHCP for configuring IP addresses for
                                the specified interface. This value must be
                                specified if an address or a gateway is being
                                configured.
           address      - IPv4 address to add or modify, optionally followed by
                          the subnet prefix length.
           mask         - The IP subnet mask for the specified IP address.
           gateway      - One of the following values:
                          <IPv4 address>: A specific default gateway for the
                                          static IP address you are setting.
                          none: No default gateways are set.  This is the default.
           gwmetric     - The metric for the default gateway. This field should
                          be set only if gateway is specified.
           type         - One of the following values:
                          unicast: Marks the address as a unicast address.
                                   This is the default.
                          anycast: Marks the address as an anycast address.
           subinterface - LUID of the subinterface on which the default gateway
                          exists.  This parameter is only needed on interfaces
                          with multiple subinterfaces.
           store        - One of the following values:
                          active: Set only lasts until next boot.
                          persistent: Set is persistent.  This is the default.
    
    Remarks: Used to enable or disable DHCP for IP address configuration.
             Also removes any previous static IP addresses and default gateways,
             and can add a new static IP address and default gateway.
    
    Examples:
    
           set address name="Local Area Connection" source=dhcp
           set address "Local Area connection" static 10.0.0.9 255.0.0.0 10.0.0.1 1
      My Computer


  3. Posts : 6
    Windows Seven
    Thread Starter
       #3

    Still doesn't work, the lines:
    netsh interface ip set address "Offboard" static 111.111.111.111 255.0.0.0
    netsh interface ip set address "Offboard" dhcp
    I don't get any response even in cmd

    I think it might have something to do with IPv6/Ipv4
    At XP, the adapter only have IPv4 I think
      My Computer


  4. Posts : 4,364
    Windows 11 21H2 Current build
       #4

    Correct.

    When I did the commands to figure out the help, ip as an option is not actually listed - only ipv4 and ipv6 are listed, leading me to think that substituting ipv4 for ip should do the trick.

    however, when I manually typed in ip as an option it brought up the help info for it, almost as if it is a hidden option....

    Unless, of course, 7 is defaulting ip to refer to ip6....which could be *another* reason you're not getting a response at all....
      My Computer


  5. Posts : 2,899
    Windows 7 Ult x64(x2), HomePrem x32(x4), Server 08 (+VM), 08 R2 (VM) , SuSe 11.2 (VM), XP 32 (VM)
       #5

    yes you should be using instead of ip ipv4...
    like this...
    Code:
    netsh int ipv4 set addr "Offboard" static 111.111.111.111 255.0.0.0
    netsh int ipv4 set addr"Offboard" dhcp
      My Computer


  6. Posts : 6
    Windows Seven
    Thread Starter
       #6

    OK
    Now I can do the primary objective (change the ip to a static one then dhcp it)
    But can't trick the internet company anymore T_T
    When I set dhcp, it comes back to the same IP
    But with XP I always got a "new" one
    I'll try to find another way to change my IP,
    Thanks anyway
      My Computer


  7. Posts : 6
    Windows Seven
    Thread Starter
       #7

    Hello,
    I'm here again, just need to know something, how do I deactivate the "preferred" IP thing?
    I don't want for windows to log the last ip, so when I do the ipconfig/release-renew thing it gets another IP by DHCP
    I know that in my internet provider I can do such thing (I did that a lot on XP)

    IPv4 Address. . . . . . . . . . . : 192.168.0.10(Preferred)
    Subnet Mask . . . . . . . . . . . : 255.255.255.0
      My Computer


  8. Posts : 2,899
    Windows 7 Ult x64(x2), HomePrem x32(x4), Server 08 (+VM), 08 R2 (VM) , SuSe 11.2 (VM), XP 32 (VM)
       #8

    you are using a router yes?
    if you are then the this is a IP for your network (any computers that you own and are connected to your router are part of this network)
    otherwise (if you dont have a router) then your this IP is being routed internally (the ISP/building is using NAT routers) and this is not a "outside" Internet IP...
    this usually happens when you have a small ISP or a ISP that is running out of external ip address and now to conserve its share may now be routing them...
      My Computer


  9. Posts : 6
    Windows Seven
    Thread Starter
       #9

    If I change the mac of my network board the IP will change, but its too complicated...

    I'm not using any router, the computer is the same way I used to do when it was XP, it's something in seven's configuration,
    When I was in dual-boot with XP i could change the IP only doing that thing I posted in the beginning of the topic, but I formated the XP partition and now I'm lost...

    I need something to make Seven forget the old IP and get any other avaliable in the provider instead of the same...

    This is my real IP, the other was just an example:
    IPv4 Address. . . . . . . . . . . : 201.75.107.73(Preferred)
    Subnet Mask . . . . . . . . . . . : 255.255.248.0
    Sorry if I can't express myself clearer, English is not my first language :P
      My Computer


  10. Posts : 6
    Windows Seven
    Thread Starter
       #10

    UP...
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:56.
Find Us