Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: [Help] Modifications in a batch file

04 May 2009   #1

Windows Seven
 
 
[Help] Modifications in a batch file

Quote:
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 System SpecsSystem Spec
.

05 May 2009   #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 System SpecsSystem Spec
06 May 2009   #3

Windows Seven
 
 

Still doesn't work, the lines:
Quote:
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 System SpecsSystem Spec
.


07 May 2009   #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 System SpecsSystem Spec
07 May 2009   #5

Windows 7 Ult x64(x2), HomePrem x32(x4), Server 08 (+VM), 08 R2 (VM) , SuSe 11.2 (VM), XP 32 (VM)
 
 

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 System SpecsSystem Spec
07 May 2009   #6

Windows Seven
 
 

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 System SpecsSystem Spec
16 May 2009   #7

Windows Seven
 
 

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)

Quote:
IPv4 Address. . . . . . . . . . . : 192.168.0.10(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
My System SpecsSystem Spec
16 May 2009   #8

Windows 7 Ult x64(x2), HomePrem x32(x4), Server 08 (+VM), 08 R2 (VM) , SuSe 11.2 (VM), XP 32 (VM)
 
 

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 System SpecsSystem Spec
16 May 2009   #9

Windows Seven
 
 

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:
Quote:
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 System SpecsSystem Spec
18 May 2009   #10

Windows Seven
 
 

UP...
My System SpecsSystem Spec
Reply

 [Help] Modifications in a batch file




Thread Tools




Our Sites

Site Links

About Us

Find 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:00 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33