Batch to set my ipv4 IP settings?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
NL111
Posts: 3
Joined: 13 Nov 2012 12:28

Batch to set my ipv4 IP settings?

#1 Post by NL111 » 13 Nov 2012 12:33

Does anything like that exist? I want to make a batch which will set my IP address to like: 30.3.3.3, with 255.0.0.0 as subnet mask, and another which will reset it back to "Obtain IP address automatically".
Can someone help me with that? I am on Windows 7 Ultimate 64 bit, and my LAN connection's name is just Local Area Connection. Here is an image of what I am talking about.
http://i.imgur.com/e1URh.jpg

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Batch to set my ipv4 IP settings?

#2 Post by Squashman » 13 Nov 2012 12:40


NL111
Posts: 3
Joined: 13 Nov 2012 12:28

Re: Batch to set my ipv4 IP settings?

#3 Post by NL111 » 13 Nov 2012 18:07

Thank you, that worked very well. I am currently using
Netsh interface ip set address name="Local Area Connection" source=static addr=192.168.150.149 mask=255.0.0.0 gateway=192.168.0.1 gwmetric=1

How would I set it back to the original settings, which is to just get the recommended values from the network?

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Batch to set my ipv4 IP settings?

#4 Post by Ed Dyreen » 13 Nov 2012 19:27

NL111 wrote:How would I set it back to the original settings, which is to just get the recommended values from the network?
U mean DHCP :?:

Code: Select all

netsh interface ip set address name="Local Area Connection" source=dhcp

NL111
Posts: 3
Joined: 13 Nov 2012 12:28

Re: Batch to set my ipv4 IP settings?

#5 Post by NL111 » 13 Nov 2012 20:35

Is that what this default setting is?
http://i.imgur.com/e1URh.jpg

If it is then thank you :)

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Batch to set my ipv4 IP settings?

#6 Post by Ed Dyreen » 13 Nov 2012 21:03

NL111 wrote:Is that what this default setting is?
http://i.imgur.com/e1URh.jpg

If it is then thank you :)
Not exactly, the above only set dhcp, to set dns aswell use

Code: Select all

netsh interface ip set dns name="Local Area Connection" source=dhcp
Don't u wanna know how i figured it out ?

Code: Select all

netsh interface ip set dns /?
:wink:

Post Reply